It is possible that from SSH into an account on a shared cPanel server the PHP version on the system is different from the one we have installed or configured for the account.
In this case, when using any composer command, it may happen that it validates the requirements incorrectly, since it does not meet them because it interprets that the PHP version is the one in the PATH, therefore, the system version and not the one of our account.
In this case, we have the option to use composer specifying the path of the PHP version we want to use as follows:
/usr/local/bin/ea-php74 composer options
If this does not work, you can specify the path to composer as well:
/usr/local/bin/ea-php74 /opt/cpanel/composer/bin/composer options
If the previous step did not work, you would have to download the composer.phar file, the steps would be as follows:
- Download composer.phar to the server. Ideally you should have it in an easily accessible path, such as the user's home directory ( cd ~ ) or similar.
We can do it manually or following the instructions and commands that the composer page indicates here:
https://getcomposer.org/download/
As of today, we do not recommend using composer 2.0 yet, as it tends to give problems with some CMS.
- Once downloaded run the command specifying the PHP version of cPanel and the composer.phar file next to the command, e.g. for a require command:
/usr/local/bin/ea-php74 composer.phar require name/package
Si todavía tienes dudas, contacta con nosotros y te ayudamos.