How to Specify PHP CLI Version for Custom Console Commands
I have multiple projects on one server, all of them are on PHP 7.4 but I've recently upgraded one to PHP 8.1 however I've ran into an issue with my custom console commands.
I need to set the PHP version dynamically based on the project that is running this. So my project that's on PHP 8.1 needs to use the PHP 8.1 CLI all the other projects need to use the PHP 7.4 CLI
Is this possible?
Just for completeness, I've tried running the commands manually and I get the following error message:
Composer detected issues in your platform:
Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.3.
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.3. in /var/www/rmguk.com/api/vendor/composer/platform_check.php on line 24