25% OFF!

Use code 25OFFER at checkout.
Sign up Login

How do I run my cron job on a specific PHP version? Print

  • cron, specific php, specify php version
  • 10

How do I run my cron job on a specific PHP version?

 

To run a cron job using a specific PHP version, you can use the following example code:

/opt/alt/php81/usr/bin/php -q FILE_PATH

Where "php81" is the PHP version you want to use (PHP 8.1) and can be changed to suit your needs. Such as php72, php73, etc.

The "FILE_PATH" is the full path to the file you want the cron job to run, such as:

/home/myusername/public_html/cron.php

The full command using PHP 8.1 would then be:

/opt/alt/php81/usr/bin/php -q /home/myusername/public_html/cron.php

 

 

 


Was this answer helpful?

« Back