How to Fix the Most Common Magento 2 Installation Issues

July 27, 2020
Adam Ritchie

How to Fix the Most Common Magento 2 Installation Issues

July 27, 2020
Adam Ritchie
Back to the blog
Get the latest straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share on:

As of July 1, 2020, there are no longer any quality fixes or security patches provided for Magento 1.

While you can technically still use Magento 1 software, without this support, you’ll be putting all the information stored on your site at risk. Magento 1 users who want to protect customer data, as well as take advantage of all the other benefits, will need to migrate to Magento 2. However, there may be some bumps along the way.

Here's how to fix the most common Magento 2 installation issues.

5 Common Issues When Migrating to Magento 2 — and How to Fix Them

These tips will help your migration go as smoothly as possible. 

1. Installation Progress Gets Stuck

Issue: Once in the Magento Setup Wizard, installation can get stuck around the 70% mark — and no error message will display.

As the Magento Setup Wizard shows,  installation can get stuck at 70%
Image source: Magento

Solution: To fix this problem, you may just need to adjust the PHP setting for max_execution_time.

  1. Use a phpinfo.php file to locate php.ini.
  1. Open the php.ini file in a text editor (note: you’ll need to be a user with root privileges to do this). 
  1. Go to the max_execution_time setting and change the value to 18000. 
  1. Save your changes and close the text editor.
  1. Restart Apache.

If you’re using nginx, you’ll also need to 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;


Then, restart nginx.

And if you’re using Varnish, you’ll need to add a timeout limit value to the backend section of your default.vcl file:

backend default {


      .first_byte_timeout = 600s;


Then, restart Varnish. 

2. Reflection Exception Error

Issue: During installation, you may run into an error message that looks like this:

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

Solution: To fix this problem, the directories and files under Magento's var subdirectory will need to be cleared, and then you’ll need to install Magento again. Enter the following commands (again, you’ll need to have root privileges for your Magento file system to do so):

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

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

If you still get the Reflection Exception error and you’re using Redis, use this command to clear your Redis cache and try again:

$ redis-cli FLUSHALL

3. Fatal PDO Error

Issue: Here’s another error message you might receive:

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

Solution: The cause of this error, most likely, is that you haven’t installed one or more of the following PHP extensions, which are all required:

  • ext-bcmath
  • ext-ctype
  • 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

Install any of the required extensions that are missing and try again.

4. Composer Version Error

Issue: There is a known bug with versions of Composer that are dated between November 21 to November 26, 2015 — they will produce the following error during installation:


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

Solution: Fixing this error involves downgrading Composer to a version released before November 21, 2015, or upgrading to a version released after November 26, 2015, and then downloading Magento again.

Use this command to confirm which version of Composer you’re using (the date of your Composer release will be listed at the end of the response):

composer -v

If your version is within the affected dates, you can use the following command to downgrade your version of Composer:

composer self-update 1.0.0-alpha11

Or you could use this command to upgrade to the latest version of Composer:

composer self-update

Then, delete your Magento 2 directory and sub-directories and download Magento again (and if you downgraded rather than upgraded Composer, after downloading Magento again you should take this chance to upgrade to the latest version of Composer). 

5. Errors Installing Optional Sample Data

Issue: Installing optional sample data allows you to learn how to use Magento before you commit to starting the process of actually creating your store. But there are also a number of errors associated with installing optional sample data, such as:

Permissions Error

The following error is caused by your file system permissions settings (from Magento Help Center):

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


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


Solution: To fix it, go back and set up your access permissions as a user with root privileges.

Production Mode Error

If you try to install optional sample data in production mode with Composer, you’ll get the following error (from Firebear Studio):

PHP 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

Solution: To avoid this error, you’ll need to instead install the optional sample data in developer mode. Log in as the Magento file system owner and enter these commands:

cd <magento_root>

bin/magento deploy:mode:set developer

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

bin/magento sampledata:deploy

SELinux Error

The following error is caused by SELinux:

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

Solution: To resolve the error, you must disable SELinux. Check out this guide from TecMint for detailed instructions on disabling SELinux.

Develop Branch Error

Finally, this is yet another error you may run into when installing optional sample data:

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

Solution: This is a known issue with the Magento 2 develop branch. You can fix this by switching to the master branch with the following command:

cd <magento_root>

git checkout master

git pull origin master

After Installation

Once you successfully install Magento 2 and address any issues, you should explore the Magento extensions library next.

Magento extensions library
Image source: Magento

Here, you’ll find apps that can help you attract more visitors to your store and enhance your user experience. For example, Omnisend will improve your email marketing efforts, and with Searchanise Smart Search Autocomplete you can use artificial intelligence to steer your visitors toward making more purchases.

You can refer to our guide on the best Magento apps of 2020 for more information on how to improve your store with extensions.

Adam Ritchie

Adam Ritchie is a writer based in Silver Spring, Maryland. He writes about ecommerce trends and best practices for Shogun. His previous clients include Groupon, Clutch and New Theory.