Calling php in my cronjob doesn’t work?

Question:

I have a crontab line that calls php but it doesn’t work. I use:

5 0 * * * php -f /home/my_home_directory/www/script.php

What’s wrong?

Answer:

Change your call to php from:

php -f /home/my_home_directory/www/script.php

to

/usr/local/bin/php -f /home/my_home_directory/www/script.php

and it will work. Crontab requires the full path (/usr/local/bin/php) to the php binary.

If you need the php-cli version, call :

/usr/local/bin/php-cli

Leave a Reply

Your email address will not be published. Required fields are marked *