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!
Works great! You are awesome! Thanks for this post.
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 .
Check the console and Error log files, is there anythnig that can help you to resolve the error
Great it solved my problems.
Could you also write about Magento 2 taking too much time to load.
thanks a lot
Sure Please check
https://magecomp.com/blog/optimize-magento-speed-performance/
https://magecomp.com/blog/magento-2-enable-gzip-compression-minify-js-css-files-for-speed-optimization/
Great it worked well!
Thanks, very useful facing this issue in windows 10 now it works.
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.