11

Magento 2 Installation error at 51%.

I am having an issue installing Magento 2. I followed every step and everything went fine until installation.The installation stops at 66% I tried to find a solution for this issue online but so far, I didn't.

Some help would be much appreciated.

Thanks.

Here is the console log :

Module 'Magento_Theme':
    [ERROR] InvalidArgumentException: Wrong file in C:\xampp\htdocs\demo\vendor\magento\framework\Image\Adapter\Gd2.php:64 Stack trace:
    #0 C:\xampp\htdocs\demo\vendor\magento\framework\Image.php(55): Magento\Framework\Image\Adapter\Gd2->open('C:/xampp/htdocs...')
    #1 C:\xampp\htdocs\demo\vendor\magento\framework\Image.php(36): Magento\Framework\Image->open()
    #2 C:\xampp\htdocs\demo\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(121): Magento\Framework\Image->__construct(Object(Magento\Framework\Image\Adapter\Gd2), 'C:/xampp/htdocs...')
    #3 C:\xampp\htdocs\demo\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
    #4 C:\xampp\htdocs\demo\vendor\magento\framework\ObjectManager\ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
    #5 C:\xampp\htdocs\demo\vendor\magento\framework\Image\Factory.php(47): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
    #6 C:\xampp\htdocs\demo\vendor\magento\framework\View\Design\Theme\Image.php(127): Magento\Framework\Image\Factory->create('C:/xampp/htdocs...')
    #7 C:\xampp\htdocs\demo\vendor\magento\module-theme\Model\Theme\Registration.php(135): Magento\Framework\View\Design\Theme\Image->createPreviewImage('C:/xampp/htdocs...')
    #8 C:\xampp\htdocs\demo\vendor\magento\module-theme\Model\Theme\Registration.php(114): Magento\Theme\Model\Theme\Registration->_savePreviewImage(Object(Magento\Theme\Model\Theme\Data))
    #9 C:\xampp\htdocs\demo\vendor\magento\module-theme\Model\Theme\Registration.php(73): Magento\Theme\Model\Theme\Registration->_registerThemeRecursively(Object(Magento\Theme\Model\Theme\Data))
    #10 C:\xampp\htdocs\demo\vendor\magento\module-theme\Setup\Patch\Data\RegisterThemes.php(47): Magento\Theme\Model\Theme\Registration->register()
    #11 C:\xampp\htdocs\demo\vendor\magento\framework\Setup\Patch\PatchApplier.php(162): Magento\Theme\Setup\Patch\Data\RegisterThemes->apply()
    #12 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(1023): Magento\Framework\Setup\Patch\PatchApplier->applyDataPatch('Magento_Theme')
    #13 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(890): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data', Array) #14 [internal function]: Magento\Setup\Model\Installer->installDataFixtures(Array)
    #15 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(371): call_user_func_array(Array, Array)
    #16 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Controller\Install.php(109): Magento\Setup\Model\Installer->install(Array)
    #17 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Controller\AbstractActionController.php(83): Magento\Setup\Controller\Install->startAction()
    #18 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))
    #19 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
    #20 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Controller\AbstractController.php(115): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
    #21 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\DispatchListener.php(117): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))
    #22 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))
    #23 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
    #24 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Application.php(339): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent)) #25 C:\xampp\htdocs\demo\setup\index.php(39): Laminas\Mvc\Application->run() #26 {main} Next Magento\Framework\Setup\Exception: Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file in C:\xampp\htdocs\demo\vendor\magento\framework\Setup\Patch\PatchApplier.php:170 Stack trace:
    #0 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(1023): Magento\Framework\Setup\Patch\PatchApplier->applyDataPatch('Magento_Theme')
    #1 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(890): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data', Array) #2 [internal function]: Magento\Setup\Model\Installer->installDataFixtures(Array)
    #3 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Model\Installer.php(371): call_user_func_array(Array, Array)
    #4 C:\xampp\htdocs\demo\setup\src\Magento\Setup\Controller\Install.php(109): Magento\Setup\Model\Installer->install(Array)
    #5 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Controller\AbstractActionController.php(83): Magento\Setup\Controller\Install->startAction()
    #6 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))
    #7 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
    #8 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Controller\AbstractController.php(115): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
    #9 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\DispatchListener.php(117): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))
    #10 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))
    #11 C:\xampp\htdocs\demo\vendor\laminas\laminas-eventmanager\src\EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
    #12 C:\xampp\htdocs\demo\vendor\laminas\laminas-mvc\src\Application.php(339): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent)) #13 C:\xampp\htdocs\demo\setup\index.php(39): Laminas\Mvc\Application->run() #14 {main}
1
  • 1
    You should not use windows, also not for developing, it is not supported. Install magento via docker.
    – Black
    Sep 23, 2020 at 14:45

4 Answers 4

34

You need to perfact solution please edit below function on line no 96 follow this- vendor\magento\framework\Image\Adapter\Gd2.php--

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

more info please refer below github url https://github.com/magento/magento2/issues/28055

3
  • 1
    thank you. it works!!!! May 3, 2020 at 20:13
  • thank you it works for me too. :) Sep 23, 2020 at 19:42
  • For those of you coming for Magento 2.4.6, this answer is still relevant. I just fixed this on 2.4.6.
    – Arfeen
    Sep 25, 2023 at 11:48
1

I had the same issue. Found a workaround on GitHub. Installed 100%.

https://github.com/magento/magento2/issues/28055

0

Yon can replace this function validateURLScheme in below file with mine one.

File name: \vendor\magento\framework\Image\Adapter\Gd2.php

    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) && strlen($url['scheme']) > 1) {
       return false;
    }

    return true;

}`

0

File name: \lib\internal\magento\framework\Image\Adapter\Gd2.php

private function validateURLScheme(string $filename) 
{
    if(!file_exists($filename)) { // if file not exist
        $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
        $url = parse_url($filename);
        if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes)) {
            return false;
        }
    }

    return true;
}

It works 100%

Your Answer

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

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