Installing Magento with Composer? Here Are Some Common Errors and How To Fix Them

Installing Magento with Composer? Here Are Some Common Errors and How To Fix Them

Magento works well for most businesses looking to create their own e-commerce website. To make the process of installation easier, there’s a tool called “Composer”. The tool is recommended by the official Magento guide as well. But when using Composer to install Magento, you’re likely face some errors. This can be hard to fix if you don’thave clarity over the error. In this article, we’ll explore some of the most common error when installing Magento with Composer and how you can fix them,

Installing Magento with Composer

Before you learn about the errors, it’s important to install Magento the correct way with Composer. If your installation process was incorrect, then you’re likely to encounter a lot of errors afterwards.

In this section, we’ll provide a brief, general overview of installing Magento with Composer. The steps involved are:
  1. Installing Composer
  2. Downloading Magento
  3. Setting Up permissions
  4. Creating databases to store the data
  5. Installing Magento
So you need to follow the above 5 steps in that order. Make sure that you have root access.

While a thorough guide is outside this article’s scope, you can refer to this guide from Magento.

Composer is basically a dependency manager for PHP. This helps you stay up-to-date with the dependencies required by Magento. With this, you do not have to manually install or update the packages. This is similar to Ng-Module in Angular which keeps the dependencies up-to-date.

Common Errors You Might Encounter

When installing Magento when working with Composer, we have seen users repeatedly run into some common errors. The amusing part is these can be solved with only a line of code, and yet people struggle with it. Here we’ll explore those common errors.
  • PHP version error
This problem is common among users who already have Composer installed on their system. When they try to upgrade their PHP package to the latest version, they often see an error flashing which reads, “You are on an older version of PHP”.

This error can be easily solved. When you inspect the PHP package installed, you’ll notice that you have set the older PHP version as default and it is being used instead of the newer version. This creates the problem with Composer and hence you see the error.

To fix this, just add the following code to the composer.json file and update the newest or your preferred PHP version:

“config” : {
“platform”: {
“php”: “7.1.3”
  • Error with Dependencies
Just like the version error, dependency errors do surface frequently when installing or updating Magento package with Composer.

If you see an error message like “Autoload error vendor autoload is not found”, then your Magento website was not accessible because a dependency was missing. To fix this problem, you need to run “composer install” inside of the root directory which will install the missing dependency packages.

Another reason because of the dependency error is people sometimes download the Composer and put it someplace in the cli path. For this, you need to change the Magento directory using the “cd” command and then run “composer update”.

If error persists despite going through the above solution, then you should get in touch with your hosting provider.
First release
Last update
0.00 star(s) 0 ratings

More resources from bhawanisingh