SOLVED Magento 2.4 Error Gd2.php On Installation

SOLVED Magento 2.4 Error Gd2.php On Installation

In this article, 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.

Let’s Start with the topic of solving Magento 2.4 Error Gd2.php On Installation

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

Solution :

As Image Adapter try opens to image files (‘open function in Gd2.php line 63). validateURLScheme function return false always because it checking ‘URL’ format but local files not valid for this format, so it returns false.

Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 96. 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 changes done in the file please execute the below command.

php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:flush

After Execution of this command, please open below link in browser and check with the result installation.

Magento 2.4 Installation

Conclusion :

Finally, we done with the point of how to solve Gd2.php Error On Installation.

I hope you like this article and if you feel like we missed out on anything, please comment below.