0

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

tlhIngan
  • 3,372
  • 5
  • 19
  • 33
Rasmus
  • 1

1 Answers1

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

joan
  • 71,024
  • 5
  • 73
  • 106