2.8.3.1. Install Composer

Composer 2.x is installed by default on the hosting; there is no need to install it separately.
  1. Connect to the hosting via SSH.
  2. Execute the commands:
    cd ~ && wget https://getcomposer.org/download/1.10.26/composer.phar
    chmod +x composer.phar
    mv composer.phar composer

    In the first command, replace 1.10.26 with the version number of Composer you need. A list of all versions is available on the official site.

  3. Install the desired version of PHP and create an alias to run Composer from any directory using any of the following methods:
    Open the "Linux configuration" section and set the following parameters:
    1. Select the desired PHP version.
    2. Add the alias composer for the command ~/composer.

    Attention!

    This method is not recommended, as the settings configured using it may be overwritten when making changes in the "Linux configuration" section.

    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, replace php73 with the desired PHP version.

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

    (3)

    Comments

    894966
    напевно це застаріла інструкція: cd ~ && wget https://getcomposer.org/download/1.10.26/composer.phar
    karlov
    Composer 2.x доступний на хостингу за замовчуванням, встановлювати його не треба. Інструкція здебільшого для тих, кому потрібен Composer 1.x, який встановлюється тільки вручну. Але таким чином можна поставити будь-яку версію.