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

1
  • What crontable are you using? root or user? Commented Jun 18, 2016 at 19:33

1 Answer 1

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.