0

I'm trying to transfer my test site from web space to local (I'm running low on maximun allowed size) I've downloaded my database and a copy of the site. Through Xampp I've imported the database, I've then inserted a copy of the site under the folder /htdocs and proceeded to connect the new database.

This is what i see online enter image description here

And this is the same site on localhost enter image description here

It's the first time i try to use a site locally, so I don't know what to do. Any idea?

1 Answer 1

1

This is known issue in Magento 2 with localhost and solution is below.

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

Replace full method (function) : isPathInDirectories() and isValid()

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


protected function isPathInDirectories($path, $directories)
{
    if (!is_array($directories)) {
        $directories = (array)$directories;
    }
    $realPath = $this->fileDriver->getRealPath($path);
    $realPath = str_replace('\\', '/', $realPath);
    foreach ($directories as $directory) {
        if (0 === strpos($realPath, $directory)) {
            return true;
        }
    }
    return false;
}

If this helps you then hit like and accept as answer.

Thank you Hiren Patel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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