Magento 2 installation issues: The simple guide to fix the common errors you should know

Magento 2 has a great number of advantages and stunning features. Also, from 1 July, 2020, there won’t be any quality fixes or security patches for Magento 1. Therefore, you want to migrate from Magento 1 to Magento 2. However, during the installation, you might encounter some problems and issues. Then, in this guideline, we’ll show you how to fix common Magento 2 installation issues

Stuck Installation Progress

This is one of the most common Magento 2 installation issues. During the Magento Setup Wizard, your installation might get stuck at about 70% mark. This means it can’t continue installing, and no error notification will be display

Magento 2 installation issues

Here’s the solution for this issue

  • First, use a phpinfo.php file to locate php.ini
  • Once you locate it, open the file php.ini in the text editor. Keep in mind that you must be a root privileges to do this
  • After that, go to the max_execution_time setting. Change the value to 18000
  • Save changes. Then, close the editor
  • Restart Apache

In case you’re using nginx, you’ll need some further steps. 

add a timeout setting to the location ~ ^/setup/index.php section of your nginx host configuration file:

location ~ ^/setup/index.php {

    …………………

    fastcgi_read_timeout 600s;

       fastcgi_connect_timeout 600s;

}

After  that, restart nginx.

Also, if you’re using Varnish, you’ll have to add timeout limit to the back end section of your default.vcl file. Here’s an example

backend default {

…………………

      .first_byte_timeout = 600s;

}

Then, restart Varnish. 

Reflection Exception Error

If you’re see an error message like this, you might encounter Reflection Exception Error

ERROR] exception ‘ReflectionException’ with message ‘Class Magento\Framework\StoreManagerInterface does not exist’ in /<path>/lib/internal/Magento/Framework/Code/Reader/ClassReader.php

To get rid of this Magento 2 installation issues, you’ll have to clear the directories and files under Magento’s var subdirectory. Then, you’ll have to install Magento 2 again. Moreover, remember that you have to have the root privileges to do that

$ cd <the name of your Magento install directory>/var

$ rm -rf var/cache/* di/* generation/* page_cache/*

However, in case you still have the reflection exception error message after this, check if you’re using Redis. Then, uses this command to clear your Redis caches first, then try again

$ redis-cli FLUSHALL

Fatal PDO Error

When having Fatal PDO Error, you’ll get this error message

PHP Fatal error:  Class ‘PDO’ not found in /var/www/html/magento2/setup/module/Magento/Setup/src/Module/Setup/ConnectionFactory.php on line 44

The main reason for this Magento installation issues might be that you haven’t installed at least one of the following required PHP extensions

  • ext-bcmath
  • ext-xtype
  • ext-curl
  • ext-dom
  • ext-gd
  • ext-hash
  • ext-iconv
  • ext-intl
  • ext-mbstring
  • ext-openssl
  • ext-pdo_mysql
  • ext-simplexml
  • ext-soap
  • ext-xsl
  • ext-zip
  • lib-libxml

Thus, to solve this problem, simply install the required extensions and try again

Composer Version Error

When you get this issue, you’ll get the following error message

ErrorException]

  file_get_contents(app/etc/NonComposerComponentRegistration.php): failed to open stream: No such file or directory

Composer Version Error is caused by a bug with versions of Composer which dated from November 21 to November 26, 2015. Therefore, to fix this problem, you will need to downgrade the Composer to the version launched before November 21,2015, or after November 26, 2015. Then, download and install Magento again

First, you need to check the version of your Composer. Use the following command

composer -v

If your Composer is in that period, you can downgrade the version using the following command

composer self-update 1.0.0-alpha11

On the other hand, if you want to upgrade the version of your composer, use this command

composer self-update

After that, delete Magento 2 directory and subdirectory. Then, download Magento again. In case you degrade the version of your Composer, you should upgrade the version after downloading Magento 

Error Installing Optional Sample Data

Installing Optional Sample Data is a great chance for you to get used to Magento before getting in creating your online store. However, during the installation of optional sample data, you might meet a lot of problems. Here are a few of them

Permissions Error

The main reason for this error is your file permissions settings

Module ‘Magento_CatalogRuleSampleData’:

[ERROR] exception ‘Magento\Framework\Exception\LocalizedException’ with message ‘Can’t create directory /var/www/html/magento2/generated/code/Magento/CatalogRule/Model/.’ in /var/www/html/magento2/lib/internal/Magento/Framework/Code/Generator.php:103

(more)`

Next exception ‘ReflectionException’ with message ‘Class Magento\CatalogRule\Model\RuleFactory does not exist’ in /var/www/html/magento2/lib/internal/Magento/Framework/Code/Reader/ClassReader.php:29

(more)

You can fix this Magento 2 installation issues by going back and setting up your access permissions as a user with root privileges.

Production mode error

This error will appear if you’re trying to install some optional sample data in production mode with Composer. The error message will look like this

HP Fatal error: Uncaught TypeError: Argument 1 passed to Symfony\Component\Console\Input\ArrayInput::__construct() must be of the type array, object given, called in /<path>/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97 and defined in /<path>/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php:37

You can avoid this problem by installing the optional sample data in the developer mode. To do this, first, log in as Magento file system owner. Then, use the following commands

cd <magento_root>

bin/magento deploy:mode:set developer

rm -rf generated/code/* generated/metadata/*

bin/magento sampledata:deploy

SELinux Error

When you receive this error message, you might encounter SELinux Error

PHP Fatal error: Call to undefined method Magento\Catalog\Model\Resource\Product\Interceptor::getWriteConnection() in /var/www/magento2/app/code/Magento/SampleData/Module/Catalog/Setup/Product/Gallery.php on line 144

Then, to solve this error, you simply disable SELinux. 

Develop branch error

The error message of Develop branch error will look like this

[Magento\Setup\SampleDataException] Error during sample data installation: Class Magento\Sales\Model\Service\OrderFactory does not exist

Then, to fix this Magento 2 installation issues, switch to the master branch using these commands

cd <magento_root>

git checkout master

git pull origin master

PHP check

Coming to one of the most common Magento 2 installation issues – always_populate_raw_post_data. When you see this error, a high chance is that there might be a mis-configuration in your php.ini file. A Readiness Check will show this error like below

guide

Then, here’s the solution for this Magento installation error. 

  • First, go to your root folder and find the php folder. Once you find it, open the file and find always_populate_raw_post_data. It should show up like this

;always_populate_raw_post_data = On

  • Then, remove the sem colon, or comment before the line of code. After that, change the On or 1 to -1. Here’s how it should look like

always_populate_raw_post_data = -1

Once you finish that, the setting is turned on and given the value of -1.

Routing problem: Redirect Loop Error

This error might be a little frustrating and complex since it involves database installation. Then, to fix this issue, you have to go to the Control panel and open your database to see the upper part of the table like path and value. 

After that, select the  core_config_data table

Find web/unsecure/base_url and web/secure/base_url under path column. Then, you must change those values from  http://localhost/*foldername*/  to http:// 127.0.0.1/*foldername*/. 

After changing those values, it’s time to clear cache. Go to the root folder of your project, then open the var folder and go to the cache folder ( /var/cache/). Then, delete all files and folders in the cache folder.

Finally, try accessing the same folder again

In conclusion

Above are some common Magento 2 installation issues and how to fix it. However, to avoid those problems and unexpected issues of Magento, you should contact experts or professional Magento developers. In this case, we highly recommend contacting ArrowHitech. We confidently help you handle every technical problem you encounter with reasonable price. What are you waiting for? Contact us here

Tags

Share