Composer

From Wiki
Jump to navigation Jump to search

Installation

Server-wide Installation

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer -V

User Level Installation

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
composer -V

Or

echo 'alias composer="php -d allow_url_fopen=On ${HOME}/composer.phar"' >> ~/.bashrc
source ~/.bashrc
curl -k -O https://getcomposer.org/installer
php -d allow_url_fopen=On installer
composer -V

Composer Update

composer self-update
composer -V

Errors

Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI

Install Composer in user home directory to fix this. Alternatively, need to use complete path of the php and composer as below: 
/opt/cpanel/ea-php74/root/usr/bin/php /opt/cpanel/composer/bin/composer

Composer cannot be run safely on non-CLI SAPIs with register_argc_argv=On

Install Composer in user home directory to fix this. Alternatively, need to use complete path of the php and composer as below: 
/opt/cpanel/ea-php74/root/usr/bin/php /opt/cpanel/composer/bin/composer