Installing Composer in VMBitrix

3 min read
1) Connect to your server via SSH. After logging in, you will see the VMBitrix menu. Enter ‘0’ to exit the menu.

Exiting the BitrixVM menu

2) Go to the project directory.

cd /home/bitrix/

Project directory


3) Create a temporary directory for downloading the package and enter it.

mkdir tmp
cd tmp

Creating the tmp directory


Download the file into the tmp directory.

curl -sS https://getcomposer.org/installer | php

Installing Composer

4) In my case, two errors occurred during installation.

4.1) mbstring.func_overload: change the value from ‘2’ to ‘0’.

mbstring.func_overload

4.2) Error message: ‘Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The json extension is missing.
Install it or recompile php without --disable-phar"

The problem is that the phar extension is not enabled on the server. To enable it, open 20-phar.ini.

nano /etc/php.d/20-phar.ini

The phar extension

If nano is not installed on the server, run the following command.

sudo yum install -y nano
After installing nano, open the file and add the line ‘extension = phar.so’.

Installing the phar extension

Then exit with Ctrl+X, save with Y and press Ctrl+X again.

5) Repeat the installation. The tmp directory should now contain composer.phar.

composer.phar

To make Composer available globally on the server, move the file to /usr/local/bin/ using this command.

mv composer.phar /usr/local/bin/composer

Moving composer.phar

6) Remove the temporary tmp directory created earlier. First, leave tmp and return to its parent directory.

cd ..
Then remove the tmp directory.

rm -R tmp
Confirm by entering Y.

Removing the temporary tmp directory

7) Done. Test the installation by running composer.

Composer installed successfully
Back to blog