1

After upgrading Magento to 2.3, My website's frontend is working fine with complete CSS. however, I am unable to open admin-backend when I hit the admin URL. it is only loading but the admin-login page is not opening in the End 500 error is displaying on the browser. do anyone know why it is occurring.

Rizwan Khan
  • 1,939
  • 2
  • 17
  • 40
sourabh yadav
  • 435
  • 1
  • 8
  • 21

2 Answers2

1

Overide the code in,

vendor/magento/framework/View/Element/Template/File/Validator.php

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;
}

You can override vendor\magento\framework\View\Element\Template\File\Validator.php Using preference

Just Create a custom module and add below code to your di.xml file

now create the class [VENDOR][EXTENSION]\View\Element\Template\File\Validator that extends Magento\Framework\View\Element\Template\File\Validator

Copy that code and replace the below function,

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;
}
aravind
  • 1,844
  • 12
  • 26
0

I had the same problem and fixed it by the below solution. You may try it

Magento 2.3.1 is not working in Xampp

Siva
  • 1,120
  • 1
  • 14
  • 33
  • it doesn't work :-( – sourabh yadav May 27 '19 at 13:05
  • Please try to run the below commands from the Magento root installation

    rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/* php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex php bin/magento cache:flush

    – Siva May 27 '19 at 13:14
  • rm -rf generated/ var/view_preprocessed var/page_cache , php bin/magento setup:upgrade , condtent deplot and last permission 777 command all the command run but result is same – sourabh yadav May 27 '19 at 13:29