How to change the PHP version for PHP scripts running with CRON
Posted: Fri Aug 12, 2022 12:27 pm
For example, let's say that domain.com's predefined PHP version is 7.4, but you want to ensure that all PHP scripts running through CRON use also PHP 7.4.
Instead of:
your CRON command should be written like this:
So, instead php just write php7.4 or other desired version of PHP.
Instead of:
Code: Select all
php /home/USER/web/domain.com/public_html/somescript.php
Code: Select all
php7.4 /home/USER/web/domain.com/public_html/somescript.php > /home/USER/php_cron.log 2>&1