SOLVED Magento 2.3.5 Error Gd2.php On Installation

1
607
Magento 2.3.5 Error Gd2.php On Installation

In this article, you going to see how to solve issue Magento 2.3.5 Error Gd2.php which is occurs on installation

While installing Magento 2.3.5 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 returns 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;   
}

Magento 2.4 Installation

If you are new and want know more about Magento 2, check with below link book which is a step-by-step instructional guide to get you started easily with Magento 2 and teach you to manage and build World-Class online stores.

Magento 2 – Build World-Class online stores: Create rich and compelling solutions for themes, and extensions

Conclusion:

Finally, we done with solution for Magento 2.3.5 Error Gd2.php in a detail and in depth.

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

1 COMMENT

  1. Hi,

    After applying the changes you mentioned above and execute the command (php bin/magento setup:upgrade) to check, the below message is coming.

    Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file

    Any solution please?

Comments are closed.