Install magento 2 with composer – Related errors and fix

Table of Contents

Composer helps to manage Magento components and their dependencies easily.

Sometimes, the customer may need to manage the PHP packages for different websites too. In such cases, composer comes handy.

However, errors may happen after user install composer in Magento 2 due to server default PHP version setting and dependency errors.

That’s why, at 1 onlyhost, we often get requests from our customers to install composer in Magento 2 as part of our Server Management Services.

Today, we’ll see how our Support Engineers set up them and fix the related issues.



How to Install Magento 2 with Composer

In simple terms, Composer allows a website owner to declare the libraries required for the websites and it will manage the packages too.

We’ll begin with the steps to install Magento2 with Composer.

1. Initially, we log into the server as a root user.

2. Then, we run the following command to install the composer

curl -sS | php

3. We download the Magento 2 by running the following command.

composer create-project --repository-url= magento/project-community-edition .

4. After that, we set up the permissions on the entire Magento 2 installation directory. An example is,

find . -type d -exec chmod 700 {} \; && find . -type f -exec chmod 600 {} \;

5. Then, we create a database with a proper database name, username, and password by using a control panel or via command line.

6. Next, we install the Magento 2 with the composer on the server

This is how we install Composer and Magento 2 on the servers.


How we fixed the related error

From our experience in managing servers, we’ve seen customers facing problems while installing Magento 2 with the composer. Let’s take a closer look at how our Support Engineers fixed the problems.


1. Server default PHP version setting

Recently, one of our customers had a problem with his installed composer. He was trying to switch his PHP version to the latest PHP version and had a problem while running the composer command. The error said “You are on an older version of PHP.

On checking, we found that it didn’t pick up PHP7. Instead, the older PHP version that was set as the default PHP version was used. This created the problem with Composer.

Then, our Support Engineers corrected the default PHP version of the account. Additionally, we corrected the ownership and set proper file permissions by using chown and chmod respectively.

That fixed the problem.


2. Dependency errors

Similarly, dependency errors can also cause problems while installing and update the Magento 2 by using composer.

Sometimes, the Magento websites may not be accessible and shows error like Autoload error Vendor autoload is not found. Please run ‘composer install’ under application root directory.

Also, some customers download composer and put it somewhere in the cli path. Therefore, it may cause dependency issues. The composer takes care of the downloading and installing the dependencies of the project. It will also create an autoload file so that those dependencies can easily be loaded from the application.

In order to solve this error, we had to switch to Magento directory by using the commandcdand then run “composer update” from there.


[Having trouble installing Magento 2 with the composer? We’ll fix it for you.]



In short, errors may happen with composer install in Magento 2 on the server due to server default PHP version setting and dependency errors. Today, we saw how our Support Engineers installed Magento 2 with composer and fixed related errors.

Leave a Comment

Your email address will not be published. Required fields are marked *

Social Share


Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale


Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month


Use coupon: at the checkout.