faqts : Computers : Programming : Languages : PHP : Installation and Setup : CGI

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

59 of 68 people (87%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How can I make a PHP script be called from the cron daemon?

Jun 14th, 1999 07:00
Nathan Wallace, Richard Lynch, Adam Trachtenberg, Michael Gerdts, Samuel Liddicott


Compile PHP as CGI (ie, leave off --with-apache or --with-apxs and keep
all the other compile switches the same).

Then, simply add a line to your cron file using crontab -e (see man 5
crontab) like usual.

Don't forget to call php with the -q option to suppress HTTP headers.

Alternatively, if you have access to lynx you can leave PHP alone and
put the following into your crontab.

    lynx -dump http://www.myhost.com/myscript.phtml

crontab mails you the results of the script automatically.  You can
suppress this mail from being sent by redirecting the output to a file:

    lynx -dump http://www.myhost.com/myscript.phtml >somefile.html