There was a problem loading the comments.

How to Set Up or Force Cron Jobs to Use a PHP Version

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

In all but our oldest servers, we have implemented a feature that allows you to set a version of PHP you want to use on your account. However, cron jobs running on a server will normally use the PHP version set for the server, and not the one specified by the PHP version tool. If your cron job needs to run with a different version of PHP, then you will need to specify it in your cron job command or script.

 

The command code for the sample cronjob is displayed below will be executed using the system PHP version set for the server:

 

php -q /home/userna5/public_html/crondir/cronscript.php

 

 

To execute the sample cronjob using a specific PHP version line say PHP version 7.4 available through 'Select a PHP version' or PHP Selector, change the command to

 

/opt/alt/php74/usr/bin/php -q /home/userna5/public_html/crondir/cronscript.php

 

 

To execute the cron using PHP 5.6 instead, replace the 74 in /opt/alt/php74/usr/bin/php with 56 to format the sample cron as

 

/opt/alt/php56/usr/bin/php -q /home/userna5/public_html/crondir/cronscript.php

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net