Invalid template file magento2.3.0

Yes, This is the problem with windows. Windows uses "\" as separator, the array "directories" contains entries with "/" as separator, so the check will always fail. So you need to fix this by replacing the separator in core file:

Magento\Framework\View\Element\Template\File\Validator

function isPathInDirectories replace below code in isPathInDirectories function

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

For me, solution worked is by going to the file \vendor\magento\framework\View\Element\Template\File\Validator.php and replacing the below function definition as below:

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

PS: This is windows specific issue.


Magento 2.3 does not support windows. You can find my solution here: enter link description here