Solved: Magento 2.2.7 and 2.3 Admin Page Blank Issue
Magento 2 CMS is a suitable platform to run E-commerce business and it can be administered via admin panel. Admin is responsible for the functionalities of the store and any error in the admin panel is not acceptable. However, the clients have been facing the issue of the blank page in the admin panel after upgrade or installation of Magento 2.2.7 and Magento 2.3!
Developers at Meetanshi have been solving this issue and decided to post it as a solution for all the store owners of Magento 2.2.7 and Magento 2.3.
If you have recently upgraded or installed the latest version and face the Magento 2.2.7 and 2.3 admin page blank issue as shown below, follow the solution given in the post.
Solution to Magento 2.2.7 and 2.3 Admin Page Blank Issue:
How to solve the Magento 2.2.7 admin page blank issue:
Navigate to: /vendor/magento/framework/View/Element/Template/File/Validator.php:113
You’ll find this code:
1 2 3 4 5 6 7 8 9 10 11 12 |
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; } |
which is to be replaced with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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; } |
How to solve the Magento 2.3 admin page blank issue:
Navigate to #/vendor/magento/framework/View/Element/Template/File/Validator.php:114
Find the below string:
1 |
$realPath = $this->fileDriver->getRealPath($path); |
and replace it with:
1 |
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path)); |
Is’nt the solution easy to implement? So now you can upgrade to Magento 2 latest version without any issues!
You may post any doubts whatsoever, in the Comments section to help you carry on your administration smoothly without any errors!
Please rate the post with 5 stars if it solved the Magento 2.2.7 and 2.3 admin page blank issue for your store
Happy Administrating!
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
52 Comments
iam getting blank screen after running the magneto 2 website on localhost. i run the cache command also still getting the same issue.
Hello Rakshitha,
Please follow the above code in order to resolve the blank screen issue.
Thank You
Thank you sir it’s helpful
Hello Ganga,
Thank You for your appreciation!
This is very helpful, And it’s clearly solution.
Hello Darshit, Thank you very much for the appreciation!
I am getting blank page on running magento2.4.1 on localhost.I have tried to change the line and also clear the cache. Please help.
Hello Vaidehi,
Run php bin/magento cache:flush command
Thank you.
I tried installing magento 2.4.1 using composer and cmd line in windows 10 but even after changing Validator.php realpath line, I am getting a blank page when I type “localhost/magento2.4”
Hello Prachi,
Run php bin/magento cache:flush command
Thank you.
Is this fixed in newer Magento 2 versions? Is there a github issue/release?
Rather than editing core files you can submit it as a pull request and a patch.
Hello Liam,
The issue that you are saying is generated in the localhost. That’s why we don’t implement a pull request.
Thank you.
The solution is not working for Magento2.4. Please help
Hello Jude,
Please clear cache and check again.
Thank you.
Sorry miss type. I input command bellow not “pop”.
“php bin/magento”
When i replace code and refresh page then this error comes
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 778281642
Please guide me
Hello,
Please check the var/report folder. The file of this log number will be created here and the exact error will be printed.
Thank you.
Hey, Thanks to your post, I was able to fix the admin issue. However, my homepage is still not loading properly. I am a pure beginner in Magento. Not sure how to fix this home page issue. Any help is appreciated.
Thanks
Hello Dheeraj,
Thank you for your appreciation.
Please run the below command for your issue:
php bin/magento cache:flush
Thanks.
Its working great. Thank you.
Hey Kishan, thanks for the appreciation
I’m glad the post helped you.
hello,
I try to install mangento2 for several days and I keep getting errors.
here is my problem after installing magento 2.3.5 on xamp 7.3.17 server:
I can’t connect to the magento admin page:
on localhost / magento2:
I have a blank page with this:
Create an Account
CMS homepage content goes here.
on localhost / magento / admin1720
I have this as a message:
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 225b8564a96f5ce6cc8d3fdf84ad7cbb5ac4f0d8df6b89976b00b2c19c55fe01
can someone help me finally install magento?
thank you
Hello,
Please run the below commands:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean
Thanks.
thanks friend‘‘‘ resolve all my problems….. for the moment‘‘‘‘ regards‘‘‘
Hey! thank you for the appreciation π
Hello Mr. Jethva
Thanks for helping beginners like me.
I tried to run the comment “pop bin/magento” and I got a message said “Could not open input file: bin/magento” could you please help me what I have done wrong? Thank you.
Hello Thomas,
Please try this:
php bin/magento cache:flush
Thank you.
Hi! I just wanted to say Thank You for posting this information. It literally took me all day to install Magento 2 on Xampp. Just when I was ready to give up on Magento (again), I saw your post. It was a breath of fresh air because your instructions worked.
Best Regards,
Karen Fletcher
Hey Karen,
I’m happy to help. Thanks for the appreciation.
@Sanjay Jethva , I have the same problem, I still get the blank screen , knowing that i am using Magento 2.3.4, kindly advice
Hey,
Please clear the cache. This solution is also applicable to Magento 2.3.4.
Thank you.
Thank you really, save my time.
Hey, happy to help π
Thanks for the appreciation!
You are awesome. it works. Thanks a lot !
Facing an error message showing error log record number 630725903879
Hi Harse,
This solution refers to the admin blank page issue. Go to var/report and find the file 630725903879 where you can see the exact error.
My magento version is 2.3.3 even after using this i am getting the error as follows:
” Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in C:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php on line 6″
Hello,
Please upload the below code at vendor\magento\framework\View\Element\Template\File
https://drops.meetanshi.com/f/sFmMm9
HI I’m still getting that black page even after try this, do you have any other ideas ?Thanks
Hello,
Are you facing this issue in localhost?
I am missing the ” framework/View/Element/Template/File/Validator.php:114 ” folders. I installed with composer so maybe thats why ?
Hey,
Yes, this can be the possibility due to installation with the composer.
What you can do now is install again using the zip and extracting it.
Thanks.
Hi Sanjay Jethva,
Thanks alot , it working now. i have to clear my cache after replace the Code.
Thanks and I really appreciate.
Happy to help π
It didn’t work for me. I got a message.
Hello,
I can help you better if you specify the message that you are getting.
Thanks
It helped , thanks
Happy to help π
you describe the solution very clearly….thank you
Thank you Arjit π
Great. Work fine. Thank you
worked like a charm! Thank you