Magento 2 blank admin page: The effective ways to solve it

Magento 2 developer mode

Magento 2 blank admin page issue in Magento 2 often happens when you upgrade Magento 2 version or  refreshing installation of Magento 2 in Localhost.  We have been encounter and solving this problems and want to show you a working solution for all the store owners of Magento 2.2.7 and Magento 2.3.

Magento 2 is  an incredibly complex platform and sometimes, errors may not occur in Live environment, but do happen in local environment. It’s important to understand the cause of the issues so that we can solve the issues the next time we encounter them.

Magento 2 developer mode

Magento support a robust admin panel that enables the store owner to solve all store function at one place. To support a smooth shopping experience to your customers and keep updated with trends one needs to update their website regularly.
But if you perform an upgrade, an migrate or refresh Magento 2 installation whether it is Community Edition or Enterprise Edition, you have seen that well known blank page error that occur nothing on the front.

1. Cause of the Magento 2 blank admin page error

The error usually display  on a localhost installation of Magento 2 on the Windows operating system. The cause for this issue is that Magento 2 and Windows has a different file path indicator.

Magento 2 blank admin page

  • On Windows, you can see path to a folder like this: C://Magento2/App/Code
  • In Magento 2, file path is: Magento2\App\Code

That’s it! The cause of the error is different file path indicators between Magento 2 and Windows, which make Magento 2 couldn’t load template files. Here is a solution if you encounter the same blank page issue after  performing a fresh installation of Magento 2.x.

2. How to solve this error in Magento 2.3

Move to  #/vendor/magento/framework/View/Element/Template/File/Validator.php:114

and find the below string:

$realPath = $this->fileDriver->getRealPath($path);

after that, you could replace it with:

$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));

3. How to solve this error in the Magento 2.2.7

Move to: /vendor/magento/framework/View/Element/Template/File/Validator.php:113

You’ll find this below code:

protected function isPathInDirectories($path, $directories)
{
    if (!is_array($directories)) {
        $directories = (array)$directories;
    }
    foreach ($directories as $directory) {
        if (0 === strpos($this->fileDriver->getRealPath($path), $directory)) {
            return true;
        }
    }
    return false;
}

You could  replace them with:

protected function isPathInDirectories($path, $directories)
    {
        $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
        if (!is_array($directories)) {
            $directories = (array)$directories;
        }
        foreach ($directories as $directory) {
            if (0 === strpos($realPath, $directory)) {
                return true;
            }
        }
        return false;
    }

4. How to fix Magento 2 admin page keep loading

Sometimes after solving the blank admin page issue, you may face admin page keep loading. You can’t do anything with the loading admin page error, even reloading the page isn’t working

Magento 2 developer mode

This error occurs due to Magento 2 didn’t finish deploying static view files in production mode.

Static view files are can be found in the <magento_root>/pub/static , and some files are cached in the <magento_root>/var/view_preprocessed directory.

Solution for this issue

  • To resolve this error, we will follow a command that forces Magento 2 to deploy static view files
  • To open CLI interface in Windows, move to your Xampp control panel and click on Shell button.
  • Follow the below command in Shell interface:
php bin/magento setup:static-content:deploy -f
  • After that, you need to wait a few seconds for Magento 2 system to deploy static content.
  • Sample output:

Magento 2 developer mode

  • Lastly, you refresh Magento 2 admin page and the issue should be solved.

That’s all about Magento 2 blank admin page and the effective ways to solve it. If you still find it difficult to solve this issues or any further questions regarding Magento, then you can get in touch with Magento experts for any free support. Magesolution is one of the leading Magento 2 extensions and Magento 2 theme providers and magento web development services in the world. With experienced Magento developers, we commit to provide high-quality products and services to help customers achieve their business success  CONTACT NOW to let us know your problems. we will make sure to solve your query

Read more

There has been an error processing your request: How to fix this issue in Magento 2

pdo_mysql extension is not installed : How to fix this issue in Magento 2

200 Total Views 9 Views Today