The Composer installation is pretty straightforward on any OS. However, there could be some not so obvious steps related to our products, such as CageFS and alt-php. The following steps will help you to get everything you need for Composer.
- Download the installer via:
/opt/alt/php70/usr/bin/php -d extension=json.so -d extension=phar.so -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
- Install Composer:
php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
- Generate CageFS config file to make it available for users:
echo -e "[composer]\ncomment=PHP Composer\npaths=/usr/local/bin/composer" > /etc/cagefs/conf.d/php-composer.cfg
- Update CageFS:
- Enable JSON and PHAR in PHP Selector for the account that will use Composer.
- To make Composer work with Suhosin, you need to adjust the /opt/alt/phpXX/etc/php.d.all/suhosin.ini file:
# echo "suhosin.executor.include.whitelist = phar" >> /opt/alt/php70/etc/php.d.all/suhosin.ini
# cagefsctl --rebuild-alt-php-ini
Done! Composer should be working at this point.