Magento 2.3-CentOS 7-page_cache不可写

问题描述 投票:0回答:1

我正在尝试在CentOS基本服务器上安装Magento 2.3.4。并出现以下错误:

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/mage2/var/page_cache" is not writable in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...') #1 /var/www/html/mage2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...') #2 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /var/www/html/mage2/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /var/www/html/mage2/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(38): Magento\Framework in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

已经运行以下命令:

sudo chmod -R 777 var/ pub/ generated

似乎是文件和文件夹所有者|组问题。然后,我创建了一个用户并将其分配给apache组,并执行以下命令来更改文件和文件夹所有者| group

sudo chown -R magento_user:apache * .[^.]*

sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; 

sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;   

sudo chmod u+x bin/magento

sudo service httpd restart

我使用CLI通过以下命令安装了Magento,并获得了成功消息

php bin/magento setup:install --base-url=http://example.com/ --db-host=localhost --db-name=dbname --db-user=dbuser --db-password=dbpass --admin-firstname=Rajiv --admin-lastname=Ranjan [email protected] --admin-user=admin --admin-password=admin@123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

仍然从浏览器访问时仍然没有相同的'写权限'错误。

非常感谢您的帮助。

magento2 centos7 file-permissions magento-2.3 magento-installation
1个回答
0
投票

运行高速缓存清理命令,然后再次授予777权限并进行检查。

  • php bin / magento缓存:干净
  • sudo chmod -R 777 var
© www.soinside.com 2019 - 2024. All rights reserved.