Categories: How ToMagento 2

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

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!

Click to rate this post!
[Total: 42 Average: 4.4]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

View Comments

Recent Posts

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

2 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

2 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

3 days ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

4 days ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

6 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

6 days ago