Php – difference between /usr/bin/php and php in crontab

cronPHP

What is the difference between specifying "/usr/bin/php" and just using "php" when setting up a PHP script to run in my crontab? I would tend to just use "php" rather than the full path.

30 16 * * *  php /var/www/vhosts/dev_crm/cron/picco.php >> /home/crmpicco/cron-picco.log 2>&1

or

30 16 * * *  /usr/bin/php /var/www/vhosts/dev_crm/cron/picco.php >> /home/crmpicco/cron-picco.log 2>&1

Thanks.

Best Answer

Who runs this crontab ?

It may be run by a different user, who does not have /usr/bin in his $PATH, or it may run with a modified environment, equally without /usr/bin in its $PATH.

If in doubt, specify the full path.