Magento 2.3.0 на Windows — пустая страница админ-панели, как исправить?
После того, как я установил Magento 2.3.0 в Open Server на виндовом компьютере, у меня не заработала админпанель — открывалась пустая страница.
Начинаю искать причины проблемы.
Консоль браузера
Сначала смотрю в консоль браузера — есть ошибки, не подгружаются скрипты. Больше ничего интересного консоль нам пока не говорит.
Идём дальше — смотрим лог-файлы.
Заходим в папку var/log внутри домашней директории вашей Мадженты. После чистой установки, и попытки открыть админпанель, у меня там уже создалось несколько файлов. Нам пока интересен один файл — system.log
Открываем его, и смотрим, что там есть самое свежее. Если там много всего — можете очистить файл и перезагрузить страницу, основная информация об ошибках должна снова записаться.
В моём случае, после очистки файла и перезагрузки страницы админпанели, я вижу следующее:
[2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:19] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:21] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:22] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/admin/login.phtml' in module: 'Magento_Backend' block's name: 'admin.login' [] [] [2019-01-03 05:45:23] main.CRITICAL: Invalid template file: 'C:/OSPanel/domains/m2.loc/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml' in module: 'Magento_Backend' block's name: 'copyright' [] []
Слишком много, но сводится всё к одному типу ошибок:
main.CRITICAL: Invalid template file
Это может ни о чём нам не говорить — тогда идём в Гугл, и смотрим, что по этому поводу пишут. Для этого, берём первую строчку с ошибкой, и убираем оттуда элементы, уникальные для вашего случая (время и папку, где установлена Маджента). Получится такое:
main.CRITICAL: Invalid template file: 'vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js'
…и находим пост на Stackoverflow, гле всё проясняется. Оказывается, есть проблема в реализации получения пути к темплейтам (не тот слеш используется для разделения пути). Для нетерпеливых — краткая выжимка из упомнянутого поста:
Исправление(скорее, временный костыль) достаточно простое:
В файле vendormagentoframeworkViewElementTemplateFileValidator.php
на строке 139 есть цикл:
foreach ($directories as $directory) { if (0 === strpos($realPath, $directory)) { return true; } }
Заменяем его на такой:
foreach ($directories as $directory) { // Add this line $realDirectory = $this->fileDriver->getRealPath($directory); // and replace `$directory` with `$realDirectory` if (0 === strpos($realPath, $realDirectory)) { return true; } }
Сохраняем изменения и перезагружаем страницу — готово:
Сообщение Magento 2.3.0 на Windows — пустая страница админ-панели, как исправить? появились сначала на Апач.
Источник: БЛОГ АПАЧА о ДЛЕ