PHP path for cron jobs

bloom360

Active Member
#1
Hi,

I have these cron jobs (using cpanel)

php /home/something/public_html/app/console mautic:segments:update >/dev/null 2>&1

And they seem to be killed or failing on each run. Should I declare PHP differently? And if so, is there a generic way to do it so as not to have to change it if the PHP version changes?
 

Pong

Administrator
Staff member
#2
Do you run this cron as user or Root?
You should run as user for such situation and can use the sytem php version if you like, the usual location /usr/local/bin/php
crontab -e something
/usr/local/bin/php /home/something/public_html/app/console mautic:segments:update >/dev/null 2>&1
You should switch to user "something" and test your cron firstly.
 

Pong

Administrator
Staff member
#4
yes, that location is the cpanel defined, system default version(not the version you choose from multi-PHP, unless your heritage system one), it won't change when you change php version from multi-PHP. Better specify a version, and change your cronjob if version changed in your cron.
/opt/cpanel/ea-phpxx/root/usr/bin/php
 
Top