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.

3

2 Answers 2

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;
}
5
  • This is bad practise, you should not be editing core code like this, especially code in the vendor directory!
    – eddhall
    Commented May 27, 2019 at 12:51
  • but it still doesn't work for me. Commented May 27, 2019 at 13:06
  • Did you overide the file or Replace that code directly in vendor file?
    – aravind
    Commented May 27, 2019 at 13:11
  • yes, I override the code. Commented May 27, 2019 at 13:25
  • remove overide and add that code directly in vendor and check
    – aravind
    Commented May 27, 2019 at 13:35
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

3
  • it doesn't work :-( Commented May 27, 2019 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
    Commented May 27, 2019 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 Commented May 27, 2019 at 13:29

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.