How do I add Composer to my hosting account?
Composer is not in the $PATH on cloud web hosting servers because the Composer package is continually updated. We instead recommend installing and maintaining your own Composer version compatible with your applications and workflow.
-
Connect to your hosting account via SSH (How do I log into SSH (shared / cloud web hosting?)
-
Create a
bindirectory in your home directory:Terminal window mkdir ~/bin -
Navigate to the
bindirectory:Terminal window cd ~/bin -
Download Composer:
Terminal window curl -s https://getcomposer.org/installer | php -- --filename=composer -
Make Composer executable:
Terminal window chmod +x composer
You should now be able to use Composer from anywhere in your hosting account by running composer.
Updating Composer
Section titled “Updating Composer”As you are managing your own Composer installation, you will need to update it manually when new versions are released. To update Composer to the latest version, run the following command:
composer self-update