I’ve installed PHP 8.1.6. Works flawless… except for my cron task for a laravel site. This is invoked as
cd /home/website/public_html && /bin/php artisan schedule:run >> /dev/null 2>&1
When I logon as root to the terminal the command php --version shows 8.1.6 but /bin/php --version is still shows version 7.4
I can’t seem to find how to make 8.1.6 the default. (/bin/php81 also does the trick but I’d rather have /bin/php set to the latest version so I don’t have to update all cron-tasks)
It must be possible to run update-alternatives --set php /bin/php81 to have it done. Although, I am not sure if that works on CentOS 7.
The work-around that should, I think, work is simply creating a symlink to needed PHP version on one of the directories that are specified first on the PATH, for example:
cd /usr/local/bin
ln -s /bin/php81 php
Restart your terminal session and see if that works.