1

我已在 mylocalhost 服务器中成功安装 Magento,当我尝试打开管理员和索引时出现此错误

[Wed Aug 01 00:47:57.088443 2018] [php7:error] [pid 12976] [client ::1:48615] PHP Fatal error:  Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/magento2/var/page_cache" is not writable in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php:209\nStack trace:\n#0 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')\n#1 /var/www/html/magento2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')\n#2 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)\n#3 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)\n#4 /var/www/html/magento2/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)\n#5 /var/www/html/magento2/lib/internal/Magento/Framework/Cache/Frontend/Ada in /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209, referer: http://localhost/

已尝试执行 chmod 777 /var/www/html/magento2/var/page_cache 仍然返回错误

4

2 回答 2

1

只需在缓存目录上写入所需的权限

chmod 777 /var/www/html/magento2/var/page_cache

甚至只是完整的 var 目录:

chmod 777 /var/www/html/magento2/var - R

为了安全起见,不建议在生产设置中使用这些权限,但对于本地开发应该没问题。

您基本上需要使该目录可被 Web 服务器写入,但这取决于您的系统设置并且是一个更复杂的答案。在这种情况下可能有点矫枉过正

于 2018-07-31T20:38:33.337 回答
0

只需使用以下命令将目录“/var/www/html/magento2/var/page_cache”的权限更改为 777。

 sudo chmod 777 /var/www/html/magento2/var/page_cache

如果没有这样的目录,可能您需要在给定位置创建目录并更改权限。

于 2018-08-01T14:05:43.017 回答