Alt php version with composer
Basically I do have cloudlinux installed at my whm server
I wanted to use Alt-php version. and I also want to install composer in all alt-php version that I required or desire.
[root@hostname~]# php -d allow_url_fopen=On composer-setup.php --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer
Downloading...
Composer (version 2.8.10) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
[root@hostname~]#
This basic command installed the composer globally but I have found that it is installed only for the default php version that ea-php81 in my case.
I tried the below code to install composer for the one of the alt php version that is 8.1 and check if it works:
[root@hostname~]# php /usr/local/bin/composer --version
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Composer version 2.8.10 2025-07-10 19:08:33
PHP version 8.1.33 (/opt/cpanel/ea-php81/root/usr/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.
[root@hostname~]# /opt/alt/php84/usr/bin/php /opt/alt/php84/usr/bin/composer install
Could not open input file: /opt/alt/php84/usr/bin/composer
[root@hostname~]#
I faced the following issue, what should I do next to install composer at alt-php versions.
-
It's not because you have only installed composer for php81. It's probably because it's the main PHP version running.
You second command is not 100% correct. It should be:
/opt/alt/php84/usr/bin/php composer installYou can find some details here:
https://support.cpanel.net/hc/en-us/articles/33990336418583-How-to-install-composer-on-cPanel-version-130-and-higherIf you use CageFS remember also to include it in the CageFS configuration.
- Michael
cPAdmins
Your European cPanel Expert Company, www.cpadmins.com0
Please sign in to leave a comment.
Comments
1 comment