There are a few ways, each of which use the crontab command.
Depending on the configuration of PHP in your Apache server (cgi or module).
Add the following line to the top of your script: #!/usr/local/bin/php -q
The -q is for quiet mode.
And by adding the scripts path to the crontab file located in /etc/ by typing crontab -e.
This will open a file in vi, or your preferred editor, in the case of vi press the i key to enter insert mode.
Add the following line
1 0 * * * php /home/dir/tasks/email.php
The to finish, press the escape key followed by semicolon ( x and !. These will save the modified file
and you'll see a message saying "crontab: installing new crontab".
Basically this line will run a the .php script 1 minute past midnight (0= 00:00 hours)
By using a text based browser such as Lynx there is not need for the bash line above,
only the adding of a line to the crontab file. By typing crontab -e a file will be opened in vi.
As mentioned in the above instructions to navigate around vi, add the following line.
Another method exists in the form of PHPCLI (PHP Command Line Interface). Which was included
in from version 4.2.0, but the attribute --enable-cli had to be explicitly typed. Since 4.3.0, however,
the phpcli file is created by default, although the paths may have changed. I mention this as the CGI maybe
replaced, renamed ....
This is similar the the CGI method, but with 1 0 * * * php /home... becomming 1 0 * * * phpcli /home.
In either method ensure that the permissions on the script are correct for the cron daemon to execute.
trying chmod 755 email.php or chmod +x email.php should resolve this.
lynx is a text based browser in linux. You can user internet explorer for this purpose here in windows. I the task property you can specify the file to be executed. ie mail.php, and the absolute path of the file. ie the server on which it is running. There sent the time where you want to run this task * in the time field indicated always.
hope that it would be clear to you.
Originally posted by barry_1030
My system is Module.
I try to use lynx to perform the job. However, it doesn't work.