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

Post Reply
User avatar
Team Member
Posts: 132
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 16 times
Been thanked: 3 times

For example, let's say that'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/
your CRON command should be written like this:

Code: Select all

php7.4 /home/USER/web/ > /home/USER/php_cron.log 2>&1
So, instead php just write php7.4 or other desired version of PHP.

Post Reply