This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
schedule an email in php
I want to schedule my php script which sends emails using windows services as the website is hosted in windows machine. I am looking for a solution which does not involve cron jobs. I want users to schedule a time and the windows service should execute my php email script on the scheduled time so that emails are sent on the scheduled user time. I want to write the entire code in php.
You don't have access to cron jobs on a Windows Machine ;) But, there isn't a way to do that without the window's scheduler unless you have a VERY active site where someone is always on it, and then you can check and run on each page load or something similar. Otherwise, I would write a script that checks the DB for when emails are suppose to be sent - and pull the ones that are suppose to be ran that minute (or half-hour, or whatever intervals you allow your users to select from), and schedule run that script every minute/interval via the windows scheduler.
Related
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to run a php script in cron
I need to run a php script at the scheduled time daily to update some fields in database and to send automated email. How I can do this?
Is it possible to write some service in XAMP server to run the script daily at scheduled time? I have no idea how to update database and send email automatically at the scheduled time. Can any one share some ideas or concepts?
I am using PHP and MySQL running in Linux Server.
Is it possible to write some service in XAMP server to run the script daily at scheduled time?
Create a Cron Job.
Look into CRON Jobs: http://en.wikipedia.org/wiki/Cron They will allow you to schedule multiple scripts to run automatically, without your intervention on a determined schedule.
you should use cron job, it will run your script automatically
http://www.thegeekstuff.com/2011/07/php-cron-job/
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
email checking and then act upon script for reacting to a sms message
Suppose that I have two functions called recieve_email() and send_sms().
The problem is that I should send SMS as soon as a new email arrives.
As I have researched, there are these 2 solutions:
Checking emails using a cron job
Checking emails using a web page that is always open using javascript (like gmail)
I think that the more stable way is the cron job.
I want to know is that aceptable to run a cron job EVERY SINGLE MINUTE? Or does it kill the server and bounce my site away?!
What about running the cron job every two minutes?! :D
Question 2:
Is there an on_mail_recieved like solution? It will be of course faster and optimum.
I want to know is that aceptable to run a cron job EVERY SINGLE MINUTE? Or does it kill the server and bounce my site away?!
Generally, that's fine. If there's a chance the job will take longer than a minute you should generally implement a lock file or semaphore to prevent it from running multiple instances at the same time.
Is there an on_mail_recieved like solution? It will be of course faster and optimum.
Yes, you can pipe e-mails through to a script. This requires you to run a mail server and can be a little involved technically.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to run a php script in cron
I need to run a php script at the scheduled time daily to update some fields in database and to send automated email. How I can do this?
Is it possible to write some service in XAMP server to run the script daily at scheduled time? I have no idea how to update database and send email automatically at the scheduled time. Can any one share some ideas or concepts?
I am using PHP and MySQL running in Linux Server.
Is it possible to write some service in XAMP server to run the script daily at scheduled time?
Create a Cron Job.
Look into CRON Jobs: http://en.wikipedia.org/wiki/Cron They will allow you to schedule multiple scripts to run automatically, without your intervention on a determined schedule.
you should use cron job, it will run your script automatically
http://www.thegeekstuff.com/2011/07/php-cron-job/
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Best way to periodically execute a PHP script?
I need to run a php script which continuously collects information from one site, and as soon as that information is collected I need the server to store the information on the database and then update other sites and to continuously repeat the process. The only problem is that I need these php scripts to run without the user visiting the page or even the site for that matter.
Not only this I need the scripts to be running 24/7 or at least run when one site has changed, enabling it to update the others almost instantly. Can anyone suggest what I can do?
You could have your PHP script run as a cron job.
(Of course, you'll need to be able to set up cron jobs on your server)
You are looking for Cron Jobs: http://en.wikipedia.org/wiki/Cron
Many hosting providers have an interface that lets you set up jobs. If your provider uses CPanel, then see this page: https://documentation.cpanel.net/display/68Docs/Cron+Jobs
If on Windows, then use Scheduled Tasks.
You have to create daemon using PHP.
Have a look at this http://devlog.info/2010/03/07/creating-daemons-in-php/
This question already has answers here:
PHP: running scheduled jobs (cron jobs)
(13 answers)
Closed 5 years ago.
I have a PHP script that checks my database's code for validity. How can I have this run everyday at a certain time so then I can just have it run on autopilot.
What you want is called a cron job and is already covered here:
PHP: running scheduled jobs (cron jobs)
If you are using cPanel on your host, you can go to Advanced --> cron jobs.
Then inside there you can set a cron job command like this:
wget http://yoursite.com/yourfile.php
which http://yoursite.com/yourfile.php should point to your desired function.
You can also set repetition time interval over there.
This way yourfile.php is called in specified intervals.
CronJobs feature are often disabled on most free or cheap Linux hosting. If you could use cron you could use that.
Alternatives:
Use services like : http://www.setcronjob.com/ (many exist, just search on google) , to schedule your task for free(1x per hour).
If you need a little bit more juice you should look into google app engine cron. In the cron you just do a simple asynchronous request to call your page.
There's a cli interpreter called php. Run your script through that as a cron job.
If you are a linux/unix user, i recommend you use CRON .
May it will helps you.
You can schedule a task in Windows - control panel->administrative tools is where you find task scheduler.
run a php automatically after every hour
Thanks
If you have your own server you can run a cronjob(unix/linux) or a scheduled task(windows).
If your app/site is hosted on a shared host that does not offer cronjobs you an use a sevice like
http://www.onlinecronjobs.com/
I have not tested this one but If you google a bit(fee conjobs) you will find plenty of those.
They will call a certain a url accoding to a fixed schedule. Most of those sevices have a fixed set of ip addeses so you can pevent the scipt from being called by anyone else.
You can easily use your database to save the last execution of the script.
Each execution of a certain page you run a script that does the following :
Check if more than 8 hours (example)
Checks in the database if the script has already been executed
If executed: does nothing.
If not executed: starts and updates the date last execution in database.