I have installed magento 2 on xampp but i have errors on admin and front page

enter image description here

enter image description here

Any idea?

3 Answers 3


To resolve this issue on the localhost.


Find the below code

if (0 === strpos($realPath, $directory)) {
    return true;

And replace it with

$realDirectory = $this->fileDriver->getRealPath($directory);
if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
   return true;

Then flush the cache and your issue will be resolved.

The answer already accepted here: https://magento.stackexchange.com/a/304239/59677

  • and deploy static content too.
    – Miguel
    Commented Feb 27, 2020 at 12:48
  • Thnk!!!!!!!!!!!
    – Miguel
    Commented Feb 27, 2020 at 12:48

after installing run the following commands on Magneto root :

sudo rm -rf var/di var/generation var/cache/* var/log/* var/page_cache/*
sudo php bin/magento setup:upgrade
sudo php bin/magento setup:static-content:deploy -f 

sudo php bin/magento cache:clean
sudo php bin/magento cache:flush

Also, Check the folder permissions. Hope it helps..


This is Magento 2 bug. And it is fixed.

Please go this file path :-


the string

if (0 === strpos($realPath, $directory)) { return true; }

to replace

$realDirectory = $this->fileDriver->getRealPath($directory); if ($realDirectory && 0 === strpos($realPath, $realDirectory)) { return true; }

And your Magento version is 2.3.3 is lower so refer this links :-

Magento 2.2.7 admin panel blank page

Hope help you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.