How to change the PHP version for PHP scripts running with CRON

Post Reply
User avatar
isscbta
Posts: 91
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 7 times
Been thanked: 3 times

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:

Code: Select all

php /home/user/web/domain.com/public_html/somescript.php 2>&1
your CRON command should be written like this:

Code: Select all

php7.4 /home/user/web/domain.com/public_html/somescript.php 2>&1
So, instead php just write php7.4 or other desired version of PHP.

Tags:
Post Reply