hi, I want to send mail to user daily. For that I will store the database some records. The PHP Script will send each record daily as mail to the user. These should be done automatically without admin or user interaction. Please give me some help or suggestion
+6
A:
PHP can be run from the command line like any shell script, Perl script or so on. See Using PHP from the command line.
For the daily job put such a command line in your cron. See Schedule tasks on Linux using crontab.
cletus
2009-11-26 07:53:25
it is also possible in windows (PHP cli executable) c:\php\php5.exe -q c:\path\to\yourscript.php (cli executable path might be incorrect)
Cem Kalyoncu
2009-11-26 07:57:12
This strikes me as a piece of "Ubuntu advice". Please explain what a crontab is, why you should run command X, and perhaps link to some resources -- like cletus' answer.
Conrad Meyer
2009-11-26 07:59:19
+1
A:
There are basically two ways to accomplish this.
The first is to configure at the operating system level to run the script at the appropriate times (e.g. cron or Windows Task Scheduler). The other option is to use a script like phpJobScheduler will will run jobs by inserting a check in your other scripts. The important thing is that you need a reasonable amount of traffic on your web server so that the check is invoked often enough.
Kitson
2009-11-26 07:55:48