Can't execute PHP via cron
My cron commands are "php -q PATH-TO-FILE"
I'm getting "/bin/sh: php: not found" errors. What path should I be using to execute PHP, or how can I find out?
update
PHP5-cli is now installed. Now I'm getting /bin/sh: /var/lib/php5: Permission denied
when all of these are run as root
Solution 1:
The command-line interpreter of PHP can be a separate package. I know it is in Debian. On Ubuntu the following command should install the requisite tools:
sudo apt-get install php5-cli
Solution 2:
Because your crontab does now know what the ENVIROMENT is so you must tell the PHP path.
/usr/bin/php -q PATH-TO-FILE
If the file is not on the above path which is the most common path in most default installation you can run the bellow command to find where it is:
whereis php