I have a php script I want to execute regularly using a crontab. I’ve done it on my own Apache/Ubuntu 11.04 server by using this code:
*/10 * * * * cd /var/cron/ && /usr/bin/php -q script.php && echo "Update Successful: $(date)" >> update.log
But on my dedicated server (Ubuntu 10.04) I can’t get the crontab to execute the script, no matter what I try. I can’t find the php binary using “locate php | grep bin” but I’ve tried referring to both the /etc/apache2/php.ini and the php.ini-production.cli files and a countless other ways recommended online.
I have the file-setup exactly the same on both servers, and have tried executing the php script outside the crontab and it works fine. Also, if I don’t try to execute the php script but just uses it to put the text into the log file, the crontab work as well. Would be thankful for some advice! 🙂
I actually figured it out after many hours of despair. First I had to:
And finally remove a hash in /etc/php5/cli/conf.d/mcrypt.ini which was causing a failure cause of depreciation. Now it works! Thanks for you time though Dagon!