Site icon webarchers

[SOLVED] Installing Magento 2 on XAMPP Got Stuck at 51%

Hello Archers,

Did you tried to install Magento 2 on XAMPP or localhost and stuck at 51%? And wasted your lot of time while searching for a solution? Don’t worry, here, you will find your solution if you still not able to install Magento 2 on XAMPP or stuck at 51% of installation process. This guide also has a step by step video to help you better.

Installation stops at 51% while installing Magento 2 on XAMPP or Localhost

So, first of all why we are seeing this error?

Because the Image Adapter tries to open image files with function validateURLScheme, which return false always because its checking ‘URL’ format but local files not valid for this format. So, to fix this problem you need to replace this function with the function mentioned below. The location for that function is \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;
  }

Once you replace that function, retry installation. It will work.

Black screen while accessing Magento 2 Admin panel

Another big problem you could face while installing Magento 2 on XAMPP is the black screen while accessing Magento 2 Admin panel.

To resolve this, you need to reach this php file:

\vendor\magento\framework\View\Element\Template\File\Validator.php

And search for this line, which look like this:

if (0 === strpos($realPath, $directory)) {
    return true;
}

And replace it with the below one:

$realDirectory = $this->fileDriver->getRealPath($directory);

if (0 === strpos($realPath, $realDirectory)) {
   return true;
}

Once you are done with replacing try to refresh the Magento 2 admin login page.

If you are having any issue accessing your dashboard, then you need to clear the cache. To do so go to the c:\xampp\php using your terminal/command prompt and run the following command to clear the cache

>php C:\xampp\htdocs\Magento\bin\magento setup:static-content:deploy -f
>php C:\xampp\htdocs\Magento\bin\magento cache:clean

If you found this guide working, kindly subscribe to our channel:

https://www.youtube.com/channel/UCORbIwcx6cp2Eg351-zGLeA

Exit mobile version