Run composer with different PHP version

15. December 2021 Cpanel, php 0

If multiple PHP versions are installed on your server you need to tell the composer which PHP version to be used.

 

The below commands tell the composer to use PHP version 7.4.

alias php="/opt/cpanel/ea-php73/root/bin/php"
alias composer="/opt/cpanel/ea-php73/root/bin/php /opt/cpanel/composer/bin/composer"

Notes:
The is a Cpanel server and the path mentioned above are for the Cpanel server only. If you use custom PHP, use the correct path accordingly.