Can .php be used in Crontab function on Linux or wil it execute only .CGI scripts?
I’m using Plesk Control panel, I did the settings as per the Crontab doc, but i think it’s not executing the php files.
Does any one have the Idea about what more to do with
3
Answers
You can only make
cron
run executables. If you wish to run a PHP script, runphp -f
followed by the script’s filename, e.g.:You can absolutely execute php script from cron.
Like this:
in the crontab:
Will execute yourscript.php every 5 minutes.
To add to the previous answers, yes crontabs can be used to execute php scripts.
You can either have them run through the php interpreter as Paul and fvu suggested, in which case you need to specify the correct path to the php interpereter ( get it in php by using exec(‘whereis php’); it will print out the path to php on your system ).
The alternative is to simply use wget to fetch the php file via http which in turn executes it.