How to Resolve Blank page Issue after installing Magento 2.x

How to Resolve Blank page Issue after installing Magento 2x

Having powerful CMS like Magento is not so easy and maintain for newbies because it takes a lot of effort to handle Ecommerce store flawlessly. But Magento community is one of the active community where developers are constantly trying to fix its core issue and enhance the Open source Community Edition. Apart from that, Magento comes with its powerful admin panel that allows the store owner to handle all store functionality at one place. To serve seamless shopping experience to your shoppers and stay updated with trends one needs to update their store regularly.

But if you upgrade, migrate or perform a fresh Magento 2 installation whether it is Community Edition or Enterprise Edition, you have seen that well known blank page issue that displays nothing on the front. Here is a solution if you are facing the same blank page issue after a fresh installation of Magento 2.x.

To do the same first you need to open “Validator.php” file located at below path.
vendor\magento\framework\View\Element\Template\File\Validator.php
Approximately around line number 133, you will find this function.

 protected function isPathInDirectories($path, $directories)

Now inside this function find this code.

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

And replace it with the below code.

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

That’s it now open your command line interface (CLI) and run following command.

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f

That’s it. Now navigate to the admin page it will start working and your blank page issue is resolved now.
Lastly, if you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends and Let us know if you are facing any issue while implementing this code.
Happy Fixing!

Magento-development-services

Previous Article

Latent Semantic Indexing Tools for Finding the Right Keywords for Optimizing Your SEO Content

Next Article

How to change Customer Password Programmatically in Magento 2

Write a Comment
  1. saroj kumar rout

    actually i got the admin page dashboard correctly without command line codings , but not able to see anything on my homepage no theme nothing , i tried to clear the cache from command line but it said could not find bin\magento .

    plz help sir .

  2. Great it solved my problems.
    Could you also write about Magento 2 taking too much time to load.
    thanks a lot

  3. Your article was so useful and I was not expecting that this will solve my problem but it actually worked like a magic!!!! I am really thankful to you and the article.

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨