2.8.3.1. Installing Composer

Note

Composer 2.x is installed on the hosting by default, you do not need to install it separately.

  1. Connect to hosting via SSH.
  2. Run the commands:
    cd ~ && wget https://getcomposer.org/download/1.10.22/composer.phar
    chmod +x composer.phar
    mv composer.phar composer

    In the first command, instead of 1.10.22 substitute the desired Composer version number. All versions are listed on official website.

  3. Install the required PHP version and create an alias to launch Composer from any directory in any of the following ways:
    Open the section "Linux configuration" and set the following parameters:
    1. Select the required PHP version.
    2. Add an alias composer for the team ~/composer.

    Attention!

    This method is not recommended, since the parameters specified with its help can be overwritten when manipulating in the section "Linux configuration".

    Run the following commands in the console:

    echo "export PATH=/usr/local/php73/bin:$PATH" >> ~/.bashrc
    echo "alias composer='~/composer'" >> ~/.bashrc

    In the first command, instead of php73 substitute the required PHP version.

  4. Connect to the hosting via SSH again or run the command:
    source ~/.bashrc
  5. Check Composer version:
    composer -V
Content