Fix Magento 2 Installation Errors After 5 Minutes

fix-magento-installation-error

In general, installing Magento 2 is usually complicated and difficult for starters. Therefore, we will point out the most 5 common Magento 2 installation errors and how to fix these to make your process easier

PHP Settings Check

The most common error when installing Magento 2 is the always_populate_raw_post_data. It means that there is a misconfiguration in your php.ini file which causes the error. Readiness Check will display this error like:

always_populate_raw_post_data_magento_installation_errors

To solve this problem you need to go to your root folder and find the PHP folder. Another solution to locate your php.ini file:

  • Use command: php -i
  • Including <? php phpinfo(); ?>in your protect file.

Then when you locate the php.ini, open the file and find always_populate_raw_post_data, once located remove the semicolon or just comment before the line of code and change the On or 1 to -1. It would show up like:

;always_populate_raw_post_data = On

After completing to edit this code and remove the semicolon, comment and change the values to -1 it would display like:

always_populate_raw_post_data = -1

And by that, it means the setting is turned on and given a value of -1 and the PHP Settings Check Error is fixed.

PHP Extensions Check

Almost time, PHP extensions are off or commented, which leads to an error in Magento 2 installation. The extension, which is the root cause of the error in Magento 2 installation, is php_intl.dll. It looks like:

php_intl_dll_magento_installation_errors

The solution for this error is locating your php.ini file. Then search for file php_intl.dll and remove the comment or the semicolon. This code is ;extension=php_intl.dll

extension=php_intl.dll is the result after you remove comment or semicolon.

After removing the comment or semi-colon, the extension php_intl.dll is activated. Then you need to run again Readiness Check to allow it to fix the error.

Installation is stuck at 65% “installing user configuration”

This problem is by apache mod_rewrite was not enabled.

For Apache 2.4 instructions:

Use this section to enable Apache 2.4 rewrites and specify a setting for the distributed configuration file, .htaccess.

Magento uses server rewrites and .htaccess to provide directory-level instructions for Apache.

+ To enable the Apache rewrite module, enter the following command:

a2enmod rewrite

+ Add the following lines to my /etc/apache2/sites-available/my.host.com

<Directory /var/www/html/m2>

            Options Indexes FollowSymLinks MultiViews

            AllowOverride All

            Order allow,deny

            allow from all

    </Directory>

+ Then run:

service apache2 restart

CSS And Javascript Cannot Be Loaded From The Correct Folder

broken-frontend-magento-2-installation-errors
magento-installation-errors-css-javascript

SOLUTION # 1 (IF YOU WANT TO EDIT XML FILE)

After successful installation DO NOT run Magento.

Now we are going to clear / delete caches and sessions of Magento 2. Go to following paths and delete everything:

ROOT > var > cache > *DELETE ALL*

ROOT > var > page_cache > *DELETE ALL*

ROOT > var > session > *DELETE ALL*

When Magento 2 is not in production mode, it will try to create symlinks for some static resources on the local server. We have to change that behavior of Magento 2 by going to edit ROOT > app > etc > di.xml file. Open up di.xml in your favorite code editor, find the virtualType name=”developerMaterialization” section. In that section below, you will find an item <item name=”view_preprocessed” xsi:type=”object”> which needs to be modified. You can modify it by changing the following content:

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

To:

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Now last step, also delete old files generated in ROOT > pub > static > DELETE ALL EXCEPT .HTACCESS

*Note: Don’t remove .htaccess.

SOLUTION # 2

we are setting up static content to deploy on our Magento store. To perform this, type “php bin/magento setup:static-content:deploy”.

If you get any error, check your PHP.EXE and PHP.INI Environment Variable

Clear / Flush Magento cache by typing “php bin/magento cache:flush” in CMD.

And finally, to Reindex Magento Static Blocks type “php bin/magento indexer:reindex”.

SOLUTION # 3

Ownership and permissions can also cause a problem. It is necessary to apply proper permissions to all files and folders of Magento 2.

Go to following paths and delete everything:

ROOT > var > cache > *DELETE ALL*

ROOT > var > page_cache > *DELETE ALL*

ROOT > var > session > *DELETE ALL*

ROOT > var > generation > *DELETE ALL*

ROOT > pub > static > DELETE ALL EXCEPT .HTACCESS

*Note: Don’t remove .htaccess.

Then run:

php bin/magento setup:static-content:deploy

php bin/magento setup:upgrade

Don’t run Magento. Go to the root folder of Magento, use this command to set:

chown -R ownername *

chmod -R 777 *

Finally, you can reload Magento. Then run to set owner and permission again.

Pub/static URL contains deployed version

Static files URL contains deployed version because of this 404 error comes.

http://domain]/pub/static/version1474443317/frontend/Magento/luma/en_US/mage/calendar.css

static files exist if we remove version 1474443317 from the URL and check but all URL contains this version 1474443317.

Access to your Mysql and run this query:

INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES (‘default’, 0, ‘dev/static/sign’, ‘0’);

Delete all pub/static except .htaccess. And run:

php bin/magento setup:static-content:deploy

php bin/magento setup:upgrade

Hope you guys find this article useful! If you meet any other Magento 2 install errors, be free to comment below and we are ready to help.

Leave a Reply

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