8

This question already has an answer here:

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' [] []

marked as duplicate by sv3n, Mohit Kumar Arora, Jai, Piyush, Manashvi Birla Dec 3 '18 at 5:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

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

  • I have tried but it's not working. – Akash Nov 30 '18 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.