Most Frequent Issues Faced During Magento 2 Installation

In this article, you going to see a discussion regarding Magento 2 frequent issues faced during installation. We will demonstrate how to resolve errors during installation of Magento in details step by step.

Common Magento 2 Issues

  • PHP Extension and Configuration Settings
  • Magento 2.4 Error Gd2.php On Installation
  • Validate a connection to elasticsearch
  • Admin Page Blank Issue

PHP Extension and Configuration Settings

One of the most common issue in Magento 2 is PHP extension and configuration settings. To resolve this issue just re-configure the php.ini settings.
C:\xampp\php\php.ini
For example error like this:
PHP Fatal error:  Class ‘PDO’ not found in /var/www/html/magento2/setup/module/Magento/Setup/src/Module/Setup/ConnectionFactory.php
on line 44
So, The solution is to check if you have installed & enalbed all of the below extensions in php.ini file:
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
ext-sockets

Magento 2.4 Error Gd2.php On Installation

you going to see how to solve Magento 2.4 Error Gd2.php On Installation in a simple way and step by step. If you are looking for this topic then you are at a right place. While installing Magento 2.4 in windows, For those who getting Error:
In the PatchApplier.php line 170:
Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file
In Gd2.php line 64:
Wrong file
So, The actual problem is Image Adapter try to open image files (‘open function in Gd2.php line 63). But validateURLScheme function return false because it is checking ‘URL’ format but local files are not valid for this format, so it returns false. So We will apply below hack to solve this issue. Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 86. Replace function with this:
private function validateURLScheme(string $filename) : bool   {
          $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
          $url = parse_url($filename);
          if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
              return false;
          }
          return true;   
}
After that save Gd2.php file and resume your installation.

Validate a Connection to Elasticsearch

Please check the sample of error you will face during installation.
Getting Error Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
Solution is simple for this problem. Follow steps described below. First download “Elasticsearch“.

Step – 1: After downloading the elasticsearch unzip that file in the below location.
C:\xampp\htdocs
Step – 2: Now open the elasticsearch folder and go to bin folder.
C:\xampp\htdocs\elasticsearch\bin
Step – 3: Now find elasticsearch.bat file in bin folder.

Step – 4: Run elasticsearch.bat file as an administrator.

Step – 5: Now continue your magento 2 installation process.

Admin Page Blank Issue

This issue mainly occurred during up-gradation, migration or perform a fresh Magento 2 installation whether it is Community Edition or it can be Enterprise Edition, you have seen that well known blank page issue that displays nothing on the front end and also occur some time in back end. So, as solution Navigate to: /vendor/magento/framework/View/Element/Template/File/Validator.php Then go to line number 138. You’ll find this code:
$realPath = $this->fileDriver->getRealPath($path);
which is to be replaced with the following code:
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
After that run following commands
$ php bin/magento indexer:reindex
$ php bin/magento setup:upgrade
$ php bin/magento setup:static-content:deploy -f
$ php bin/magento cache:flush
Refresh the page, You can see your issue is resolved now.

We have covered almost all common issue faced during installation of Magento 2. If you are facing issue that is not listed here, then please drop your issue in comment section or contact us. We will be happy to help you.

Leave A Comment