0

i was intalling magento 2.3.5 which the lattest magento edition on my local system and encountered this strange error. when i dig a bit in to it, i found this solution which works well but i wana know why this happens. am sharing full lines code that has been changes in order to make it working as they have not explained it. enter image description here

vendor\magento\framework\Image\Adapter\Gd2.php file. at line 96

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;
  }
2

2 Answers 2

1

To answer your question "why this happens".

As you can see that the code in validateURLScheme() checks if parsed scheme is one of above four $allowed_schemes. Since windows directory convention is different than linux, the function always returns false due to local windows files do not validates the condition.

To avoid this convention issue we add !file_exists($filename) condition. !file_exists() will satisfy if condition only when file is not found. Since file is found it will return true from validateURLScheme(). Which solves our problem.

As Kalvin mentioned in comment Magento v2.3 is not supported in Windows OS as per official doc. So we had to make such changes in core files.

Hope it answers your question. Thanks

4
  • isn't these changes in core file going to effect in future releases from magento??
    – Pramod
    Jul 6, 2020 at 5:47
  • Yes definitely it will. when you update your Magento version, the core files are replaced with new ones. So you have to redo them. To get rid of this the suggested approach would be to use VM stack. Jul 6, 2020 at 5:56
  • Thanks you so much
    – Pramod
    Jul 6, 2020 at 6:06
  • Please accept & upvote the answer if you like it. Thanks ;) Jul 6, 2020 at 6:08
0

You cannot install Magento2.3.5 on Windows. It must be installed on Linux environment only. If you want to run Magento on Windows, use VM tools e.g. Vagrant , Virtual box, Docker. Many Magento features are supported under Linux only e.g. symlink inside pub/static css/js file

1
  • as am not familiar with linux do you have any best tutorials that will help me install magento 2 over linux system
    – Pramod
    Jul 6, 2020 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.