Composer installation is only possible when using automatic PHP settings management. In manual mode, you may encounter errors due to missing extensions. To learn how to switch site and web server modes, see the relevant instruction.
ls -lah /usr/local | grep php
Example: For PHP 8.0, the path is: /usr/local/php80/bin. Do not use the global (shared) PHP version — it may cause many errors. Instead, we recommend using the Multisite option.
PHP_PATH=/usr/local/php80/bin
PHP=$PHP_PATH/php
Now you can use $PHP instead of typing the full path every time.
mkdir -p bin
To go to the directory, use:
cd bin
curl -sS https://getcomposer.org/installer > composer-setup.php
cd ~
$PHP bin/composer-setup.php --install-dir=bin --filename=composer
echo "PATH=\"$PHP_PATH:\$PATH\"" >> ~/.profile
echo "alias composer='$PHP /home/h000000001/bin/composer'" >> ~/.profile
Where /home/h000000001 is the root directory path of your hosting service (from step 2).
echo 'source ~/.profile' >> ~/.bashrc
source ~/.profile
composer
