简体   繁体   中英

Run cron job on cpanel with php7 version

I want to setup cron job on cpanel admin with php7 version. My php script for cron requires php 7.0 or above to run. The problem is that the path to php7 cannot be found. I have already selected php 7.0 as current version in cpanel. I do not have access to ssl.

what I have done is similar to this this

/usr/local/cpanel/3rdparty/bin/php "/home/username/public_html"/myjob.php >> "/home/username"/myjob.log 

This works for scripts which runs with php 5.6 but my problem is that the job myjob.php requires php 7.0. I tried to run with php7 , php70 , php7.0 but none run. I tried to run like this.

/usr/local/cpanel/3rdparty/bin/php7 "/home/username/public_html"/myjob.php >> "/home/username"/myjob.log 

My problem is that I cannot find the the path to php7. Where is the path to this version? How can I run this?

Command to run a PHP 7.0 cron job:

/opt/cpanel/ea-php70/root/usr/bin/php /home/username/public_html/myjob.php >> /home/username/myjob.log

Command to run a PHP 7.1 cron job:

/opt/cpanel/ea-php71/root/usr/bin/php /home/username/public_html/myjob.php >> /home/username/myjob.log

Command to run a PHP 7.2 cron job:

/opt/cpanel/ea-php72/root/usr/bin/php /home/username/public_html/myjob.php >> /home/username/myjob.log

/usr/local/bin/ea-php70 "/home/username/public_html"/myjob.php >> "/home/username"/myjob.log

您还会发现cpanel的cron作业页面中有一些示例。

I think you need to change it to

/opt/cpanel/ea-php70/root/usr/bin/php /home/username/public_html/myjob.php >> 
/home/username/myjob.log

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM