skip to Main Content

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?

3

Answers


  1. 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!

    Login or Signup to reply.
  2. /usr/local/bin/ea-php70 "/home/username/public_html"/myjob.php >> "/home/username"/myjob.log
    

    You will also find there is some examples inside cpanel’s cron job page.

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search