Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Run PHP file as cronjob
June 21, 2006, 7:51 pm
rate this thread
I have a PHP file that reads another PHP file and writes it as a static
HTML page. I'd like to run the first PHP file as a cronjob (so that the
static HTML page is updated once an hour).
I'm familiar with scheduling a cronjob and all the PHP is working
perfectly. I don't know how to get cron to "run" a PHP file however.
Any advice would be greatly appreciated.
Re: Run PHP file as cronjob
If you have the CLI version of PHP installed, simply write
@hourly /path/to/php/interpreter/php /path/to/php/script.php
Use wget/lynx/curl etc etc to fetch the file via the webserver. You can
then either echo the content out, and have wget/...etc save it to
wherever you want it, or you can still do this in the PHP-script, and
don't return any content to wget