4

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

Ashish Viradiya
  • 1,562
  • 2
  • 18
  • 39

4 Answers4

9

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.

Abu Dujana
  • 91
  • 1
  • 1
4

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;
    }
Andrey Rad
  • 901
  • 8
  • 7
4

Go to /vendor/magento/framework/View/Element/Template/File/Validator.php then find this code

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

Now replace it with the below code.

$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
-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

Shashank Gupta
  • 688
  • 6
  • 14
  • 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 '19 at 09:20