4

enter image description here I have installed magento 2.3 latest version, But I never login in admin panel.

5

I am new to magento, I faced the same problem and found the follwoing solution:

Magento 2.3.1 File Location:

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

Code:

public function isValid($filename)
{
    $filename = str_replace('\\', '/', $filename);
    if (!isset($this->_templatesValidationResults[$filename])) {
        $this->_templatesValidationResults[$filename] =
            ($this->isPathInDirectories($filename, $this->_compiledDir)
                || $this->isPathInDirectories($filename, $this->moduleDirs)
                || $this->isPathInDirectories($filename, $this->_themesDir)
                || $this->_isAllowSymlinks)
            && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename));
    }
    return $this->_templatesValidationResults[$filename];
}

To Replace with this simple code:

public function isValid($filename)
{
   return true;
}

It works for me and hope will work for someone like me.

  • Good its worked for me. Thanks. But, Is it make any trouble infuture on any work? – Teja Bhagavan Kollepara May 29 at 4:27
2

This is Magento bug. Wrong paths to Windows are generated. The fixed fix is

Magento 2.3.0

#/vendor/magento/framework/View/Element/Template/File/Validator.php:114

the string

$realPath = $this->fileDriver->getRealPath($path);

to replace

$realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));

Magento 2.2.7

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

code

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

to replace

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

Try to delete files and folder from following location :

rm -rf root/pub/static/adminhtml root/pub/static/frontend root/pub/static/deployed_version.txt
  • Give proper permission to static folder
  • Run following command :

    bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy

May be issue is static file are not deployed properly , above step will regenerate static files . Thanks

  • There are some situation , when templates are not generated fully , and cause blank page issue , at least I faced this issue , So with due respect, may I know your opinion why you did negative vote , could you justify your verdict . Thanks – Shashank Gupta Aug 13 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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