3

After successful installation when i run the admin url it's giving me this. I'm not sure what's happening. So if anyone have any solution for this it will be great help.

Image

  • check logs may be something thair – Adarsh Shukla Dec 3 '18 at 9:02
  • i don't know actually what to check in logs. This is the first time i'm installing magento. Can you be more specific? – Rasel Uddin Dec 3 '18 at 9:04
  • which os r u using – Adarsh Shukla Dec 3 '18 at 9:05
  • @AdarshShukla windows 10 – Rasel Uddin Dec 3 '18 at 9:06
  • find errors.log file in your server – Adarsh Shukla Dec 3 '18 at 9:07
22

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;
    }
  • $realPath = $this->fileDriver->getRealPath($path); there is no such line – Rasel Uddin Dec 6 '18 at 7:42
  • gave the answer in more detail – Andrey Rad Dec 6 '18 at 16:02
  • 1
    oh my god why, just spent 3 hours on this, magento is shipping code with bugs on a vanilla installation – Yehia A.Salam Dec 30 '18 at 15:58
  • 1
    Great!! Helped me for 2.2.7 – Gaurav Agrawal Feb 22 at 10:46
  • 1
    @Andry Rad, same bug in magento version 2.3.1 also there – Hitesh Balpande Mar 28 at 13:09
1

If You can't find out the (/vendor/magento/framework/) folder in magento 2. Then You can check it here:

C:\xampp\htdocs\magento\lib\internal\Magento\Framework\View\Element\Template\File\Validator.php

protected by Community May 24 at 5:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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