Categories
Laravel Samuel Uncategorized

Setting Composer To Use PHP 7.3 From Command Line

So we ran into a little bit of an issue today when upgrading Laravel from 5.6 -> 6.0. We updated the version of PHP using the MultiPHP Manager section in Cpanel, however when we then SSH’d into the server to pull in the updated Laravel code and run composer install we ran into the issue of composer using the system version of PHP. The full process we went through is below:

Update the version of PHP on MultiPHP manager page:

We then SSH’d into the server to pull in the new Laravel code. When we did this, we got the following error message:
To get around this issue we created a shim script, so now instead of running:
composer install

We instead ran:

~/bin/composer install

Composer now uses the version of PHP defined in the shim script, which in our case is PHP 7.3 and we are back to all green happy lines 🙂