Magento2-2.3.4 windows安裝完magento無法加載靜態資源導致無法進入后台登錄頁面


后台面無法進入,截圖如下

首先查看var/log/system.log日志文件,發現報錯信息如下

RROR: Error: Application is not installed yet.  [] []
[2020-03-25 00:16:08] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 00:53:11] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:27:55] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:39:38] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:42:31] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:56:42] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Cookie/view/base/templates/html/cookie.phtml' in module: '' block's name: 'cookie_config' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] []

 

解決方法

找到lib\internal\Magento\Framework\View\Element\Template\File\Validator.php文件中的isPathInDirectories方法

$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));替換$realPath = $this->fileDriver->getRealPath($path);

看結果

如果還是不行,可以嘗試如下操作

INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

php bin/magento cache:clean

 

如果登錄頁面可以打開,但是圖片和CSS報404,可以執行正面命令

sudo php bin/magento setup:static-content:deploy -f
sudo php bin/magento cache:flush

如果登錄頁面打不開只顯示No input file specified.

請檢查 var/cache緩存目錄是否有寫入權限,如果沒有執行正面命令

sudo chmod 777 var/cache -R

 

 如果登錄頁面打不開,然后exception報class not exist,執行正面命令

sudo php bin/magento setup:di:compile
sudo php bin/magento cache:flush

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM