In this article we describe how to install and configure PHP Composer, a Dependency Manager for PHP, on your Ecenica shared hosting account.
Steps to install Composer
- Log in to your account via SSH.
- For help setting up SSH access in cPanel please see How to enable SSH in cPanel.
- Enter the following command, replacing USERNAME with your own cPanel account username.
echo 'alias composer="php -d allow_url_fopen=On /home/USERNAME/composer.phar"' >> ~/.bashrc
- Enter the following command to load the new bash enviroment variables.
source ~/.bashrc
- Download the Composer installer.
cd ~ ; curl -k -O https://getcomposer.org/installer
- Install Composer.
php -d allow_url_fopen=On installer
- Confirm Composer is installed.
composer -V
If successfully installed, Composer will return the version number. For example:
Composer version 1.9.0 2019-08-02 20:55:32
- To update Composer to the latest version run the following command:
composer self-update