0

This question already has an answer here:

Every 15 minutes, I need to run a PHP script. So I created a execute.sh file containing this line:

#!/bin/sh
php execute.php >> twitter.log

When I run the script manually, it works. Oddly, running it from cron is not working. Here is the contents of crontab:

*/15 * * * * /var/www/TwitterBot-master/execute.sh >> /dev/null 2>&1

Obviously, the script has the right permissions.

Thanks for your help

marked as duplicate by goldilocks Jun 19 '16 at 3:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What crontable are you using? root or user? – fcm Jun 18 '16 at 19:33
3

You should always use the full path when you don't know the execution environment.

Use the full path to the php executable.

Perhaps

/usr/bin/php /var/www/TwitterBot-master/execute.php >> /var/www/TwitterBot-master/twitter.log

Not the answer you're looking for? Browse other questions tagged or ask your own question.