12

I have installed new Magento 2.3 in my localhost. it is a successfully installed. But When I open an admin URL it comes with blank URL. Also, my homepage comes without Magento default logo. Also, I face another issue on homepage When I clicked on to create an account it redirects successfully but it comes with a blank page.

Please see attached images for better ideas.

enter image description here enter image description here enter image description here

Here is system.log

2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] []
[2018-11-30 08:35:09] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] []
[2018-11-30 08:35:15] main.CRITICAL: Invalid template file: 'D:/xampp/htdocs/Akashdev/Magento23/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] []
13

3 Answers 3

15

This would be a bug that addresses this commit. Author changed $path to

$this->fileDriver->getRealPath($path)

which is simply calling realpath() on $path but that might change directory separators on the $path that previously were affected by

#/vendor/magento/framework/View/Element/Template/File/Validator.php:114
$filename = str_replace('\\', '/', $filename);

On a Windows OS this will revert changes of above str_replace so that a path like

D:/Magento2.3/vendor/magento

will be canonicalized to its Windows specific version:

D:\Magento2.3\vendor\magento

and this will not result in a successful comparison within isPathInDirectories() method of Magento\Framework\View\Element\Template\File\Validator class:

foreach ($directories as $directory) {
    if (0 === strpos($realPath, $directory)) {
        return true;
    }
}

Solution

Currently we can go for a dirty quick change in the above foreach loop so that we can run our magento with no further problems on this:

#/vendor/magento/framework/View/Element/Template/File/Validator.php:139
foreach ($directories as $directory) {
    // Add this line
    $realDirectory = $this->fileDriver->getRealPath($directory);
    // and replace `$directory` with `$realDirectory`
    if (0 === strpos($realPath, $realDirectory)) {
        return true;
    }
}
2
  • why not use DIRECTORY_SEPARATOR instead of hardcoded variants of slashes?
    – Zippp
    Jan 18, 2019 at 13:39
  • Taking care of DIRECTORY_SEPARATOR should be done by the authors as we aren't aware how many manual replacements exist.
    – revo
    Jan 18, 2019 at 13:54
0

If you installed this on your local computer (not a server on the network).

please try to change baseurl in db core_config_data to: 127.0.0.1

browse your website at either http://127.0.0.1 or http://localhost

1
  • 1
    I have tried but it's not working.
    – sky
    Nov 30, 2018 at 8:42
0

This link should fix your issue. https://github.com/magento/magento2/issues/19480#issue-386162790

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