skip to Main Content

I have installed latest version of magento in my localhost.
After login to admin panel dashboard keeps loading.

Here is the image-

enter image description here
Please help to solve this error.

3

Answers


  1. Chosen as BEST ANSWER

    First Go to magento root directory then :

    vendor/magento/framework/view/element/tempalate/file/validator.php (dont exactly copy this url just follow this path)

    open this file using any editor and change this line

     $realPath = $this->fileDriver->getRealPath($path); //you can comment this out
        with this one
    
    $realPath = str_replace('\','/',$this->fileDriver->getRealPath($path));
    then goto to
    

    app/etc/di.xml

    and search for view_preprocessed

    you will find a whole line like this :

    MagentoFrameworkAppViewAssetMaterializationStrategySymlink and change the Symlink with Copy


  2. Magento 2.3

    1. go to libinternalMagentoFrameworkViewElementTemplateFile

    2. go to the function isPathInDirectories and replace the function with following

       protected function isPathInDirectories($path, $directories)
       {
           if (!is_array($directories)) {
               $directories = (array)$directories;
           }
           //$realPath = $this->fileDriver->getRealPath($path);
           $realPath = str_replace('\','/',$this->fileDriver->getRealPath($path));
           foreach ($directories as $directory) {
               //$realDirectory = $this->fileDriver->getRealPath($directory);
               $realDirectory = str_replace('\','/',$this->fileDriver->getRealPath($directory));
               if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
                  return true;
               }
           }
           return false;
       }
      
    3. go to app/etc/di.xml then search for view_preprocessed

    you will find a whole line like this :

    MagentoFrameworkAppViewAssetMaterializationStrategySymlink and change to MagentoFrameworkAppViewAssetMaterializationStrategyCopy

    Login or Signup to reply.
  3. #1. go to vendor/magento/framework/View/Element/Template/File/Validator.php#
    #2. go to the function isPathInDirectories and replace the function with following:#

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

    #3. go to app/etc/di.xml then search for view_preprocessed

    you will find a whole line like this :

    MagentoFrameworkAppViewAssetMaterializationStrategySymlink and change to
    MagentoFrameworkAppViewAssetMaterializationStrategyCopy #

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search