How to Install Composer in CWP/Vesta/Cpanel/Plesk – CentOS/Ubuntu

In this tutorial we’ll install composer quickly and learn how to update composer and use different php version paths with composer, Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Composer can be installed in your server quickly and its very easy to install :-

Installation of Composer
Switch into the /usr/local/bin directory.

cd /usr/local/bin
Download and installing Stable version of Composer by using cURL :

curl https://getcomposer.org/composer-stable.phar -o composer
Fix the permission also this will create global access to composer i.e. user having shell access can execute composer :

chmod 755 /usr/local/bin/composer
For ubuntu/debian you need to follow this steps :

ln -s /usr/local/bin/composer /usr/bin/composer
That’s it composer is successfully installed.

you can now use composer command in shell to execute.

Check Composer version :

composer -V
eg. :

[root@server bin]# composer -V
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.0.7 2020-11-13 17:31:06
Update composer upon new version releases :
to update composer you just need to run this command :

composer self-update
**it will update to stable latest version

Run different php version with the composer :
you need to user the full path for php bin and composer path with the composer sub command we use “install” command here as eg:

/path/to/php-bin /usr/local/bin/composer install
For CWP run composer as php selector and php-fpm selector :
For php selector :

/opt/alt/php56/usr/bin/php /usr/local/bin/composer install
/opt/alt/php70/usr/bin/php /usr/local/bin/composer install
/opt/alt/php71/usr/bin/php /usr/local/bin/composer install
/opt/alt/php72/usr/bin/php /usr/local/bin/composer install
/opt/alt/php73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php74/usr/bin/php /usr/local/bin/composer install
/opt/alt/php80/usr/bin/php /usr/local/bin/composer install
/opt/alt/php81/usr/bin/php /usr/local/bin/composer install
For php-fpm selector :

/opt/alt/php-fpm56/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm70/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm71/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm72/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm73/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm74/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm80/usr/bin/php /usr/local/bin/composer install
/opt/alt/php-fpm81/usr/bin/php /usr/local/bin/composer install
For Cpanel/WHM :
ea-php71 /usr/local/bin/composer install
ea-php72 /usr/local/bin/composer install
ea-php73 /usr/local/bin/composer install
ea-php74 /usr/local/bin/composer install
ea-php80 /usr/local/bin/composer install
ea-php81 /usr/local/bin/composer install
For other panel’s multi php refer to the official docs and paths for the php bin file

Troubleshoot :
if you get below error then php is not installed in default location you need to specify the path for php bin

/usr/bin/env: ‘php’: No such file or directory

source : How to Install Composer in CWP/Vesta/Cpanel/Plesk – CentOS/Ubuntu – blog.alphagnu.com – Tutorial made Easy

Posted on: October 21, 2024, by :  | 15 views
https://serang.ut.ac.id/css/css/slot88/ https://tinjut.bagkeu.dikdasmen.kemdikbud.go.id/slot-maxwin/ https://dpm.polinema.ac.id/slot-gacor/ https://akademik.ft.unm.ac.id/slot-dana/ https://ppdb.probolinggokab.go.id/slot-5000/ https://bkad.sulselprov.go.id/assets/ https://ojs.balidwipa.ac.id/docs/slot-gacor/ http://korpri.pekalongankab.go.id/api/slot-gacor/ https://elang.umpp.ac.id/foto/farmasi/-/asset/ http://rsud-kelet.jatengprov.go.id/wp-content/-/asset/ https://kusdhianto-fe.staff.ugm.ac.id/slot88/ http://ppdb.probolinggokab.go.id/judi-bola/ https://bapenda.labuhanbatukab.go.id/racikan-sbobet/ http://rsud-kelet.jatengprov.go.id/wp-content/-/data/ https://agenda.riau.go.id/-/judi-bola/ https://balapan.padang.go.id/sbobet88/ http://jdih.wakatobikab.go.id/sbobet88/ http://kph.menlhk.go.id/sbobet88/ https://bkad.sulselprov.go.id/data/ https://dpm.polinema.ac.id/slot-gacor/ https://dinkes.jemberkab.go.id/storage/attachments/