Thanks
You are the real Hero Saved Me
PLEASE update on the "How localhost can be enhanced"
@kanhaiya5590 wrote:After facing same issue looking into the error area.
found a solution and it working for me.
...\vendor\magento\framework\View\Element\Template\File\Validator.phpA function isPathInDirectories added a line
$realPath = str_replace('\\', '/', $realPath);or refer below code function
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; }It's working.
@saiorkrish if issue solved,Click Kudos & Accept as Solution.
thanx alot
after that i am getting "fatal error:Namespace declaration statement has to be the very first statement or after any declare call in the script in C:\xampp\htdocs\vendor\magento\framework\View\Element\Template\File\Validator.php on line 6 " even when there is no space after <?php
@aman10900 wrote:after that i am getting "fatal error:Namespace declaration statement has to be the very first statement or after any declare call in the script in C:\xampp\htdocs\vendor\magento\framework\View\Element\Template\File\Validator.php on line 6 " even when there is no space after <?php
This issue come because of space before PHP start tag of class file, just removed white-space to resolved:
<?php
namespace Magento\Framework\View\Element\Template\File;
to
<?php namespace Magento\Framework\View\Element\Template\File;
so always keep PHP start tag in first line.
@aman10900 Hope this will help you.
Thank you.
This code works for me
Awesome. Was getting this issue since y'day and tried two version of XAMPP and Majennto. Search a lot in the web and finally your solution worked. Thanks a lot!
one year later, problem still happens on some fresh M2. And the solutions still works like a charm.
Thanks !
Thank you for the solution.
I am using Magento version 2.3, and was presenting the error: "main.CRITICAL: Invalid template file: 'C: /cursomagento/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml 'in module:' 'block name:' require.js' "
I was able to resolve with your help.
Thank you.
Hello,
After including the line, it's good for the admin screen.
Thanks for this
However I allways have a blank screen when i go to store at the localhost/magento2 adress.
View1.png
If i click on "Create an account" i will have "Luma" and others informations on the screen
View2.png
Could you tell me if it's because i have a magento version without sample ?
Thanks
Bruno.
Thank you so much! After 3 full days of trying all the other stuff, changing permissions, changing WAMP to XAMPP, changing PHP versions, changing PHP versions of local machines, trying Windows CMD and Linux CMD, Composer install... This finally did the FKN trick! Can't thank you enough, even took the time to create an account to reply... think that says it all