【问题标题】:Magento before install on centos 7 getting 500 internal server error在centos 7上安装之前的Magento出现500内部服务器错误
【发布时间】:2017-01-18 06:12:23
【问题描述】:

您好,我正在尝试在我的 centos 操作系统中安装 magento 1.9.x 和 magento2。以下链接有助于在 centos 中配置 apache2.4、php7 和 mysql5.7。

Install magento link

在配置 web 服务器、php、mysql、magento 文件和所有文件之后。我为 magento2 创建数据库。基于上面的链接,我一个接一个地完成了所有步骤。在我在浏览器 localhost/magento2/ 中运行后

它在萤火虫和空白浏览器中显示 500 内部服务器错误。

我是centos和magento的初学者

请任何人帮助如何解决我过去两天所花费的这个问题。

Apache 错误日志:

[2016 年 9 月 10 日星期六 14:22:33.728848] [:error] [pid 2809] [client ::1:45432] PHP 致命错误:未捕获 Zend_Cache_Exception:cache_dir “/var/www/html/magento2/var/page_cache”不可写入 /var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php:209\‌​nStack 跟踪:\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/Ca‌​che/Frontend/Factory‌​.php(158): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', 数组,数组,真,真,真)\n#5 /var/www/html/magento2/lib/internal/Magento/Framework/App/Ca‌​che/Frontend 在 /var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php 在第 209 行

【问题讨论】:

  • 该错误与Apache有关,不查看Apache日志是不可能知道的。刷新页面`localhost/magento2,检查 /var/log 文件夹并搜索 Apache 日志。此外,这个问题在 ServerFault 而不是 StackOverflow 中会更有意义。
  • @Marcs 我检查了 var/log 目录.. 我在里面找到了 httpd 文件夹,我看到 access_log 文件包含以下错误 ::1 - - [10/Sep/2016:11:12:05 + 0530] “GET /magento2/ HTTP/1.1” 500 - “-” “Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0”....
  • 你需要查看error_log,查看apache文档中关于错误日志的文档:httpd.apache.org/docs/2.4/logs.html
  • [Sat Sep 10 14:22:33.728848 2016] [:error] [pid 2809] [client ::1:45432] PHP 致命错误:未捕获 Zend_Cache_Exception: cache_dir "/var/www/html /magento2/var/page_cache" 在 /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Cache.php:209\n堆栈跟踪:\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...', 数组, true, true)\n#4

标签: magento installation centos7


【解决方案1】:

在我看来这是主要问题:

未捕获的 Zend_Cache_Exception: cache_dir “/var/www/html/magento2/var/page_cache”在 /var/www/html/magento2/vendor/magento/zendframework1/library‌​/Zend/Cache.php:209 中不可写 \‌​n堆栈

您对此文件夹的权限或所有者错误。您可以使用chown 修复该文件夹的所有者或使用chmod 修复该文件夹的写入权限来修复此问题。

试试这个:

chown -R apache.apache /var/www/html/magento2/

这会将整个 magento2 文件夹设置为 apache 作为所有者和组。这不是最好的安全措施,但可以用于测试。

【讨论】:

  • 即使我遇到同样的错误,我也会使用它来更改所有者和文件权限
  • 如果您在 error_log 中仍然遇到相同的错误,那么您仍然需要修复该缓存文件夹的权限/所有者。如果这是 centos 的正确用户(serverfault.com/questions/416236/…),您最好的办法是将所有者设置为 apache.apache。如果错误发生变化,我建议您检查 error_log 并在线搜索信息,这样的安装问题通常都有记录。
猜你喜欢
  • 2015-03-14
  • 1970-01-01
  • 2015-09-25
  • 2012-07-20
  • 1970-01-01
  • 1970-01-01
  • 2011-10-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多