PHP 警告 : Unknown: failed to open stream

标签 php apache

我最近编辑了 apache httpd.conf 文件以使 mod_rewrite 工作。我不知道这个问题是否源于那个,但是我从那天开始就遇到了这个问题。
这是我在运行软件时在前端看到的 -

Server error The website encountered an error while retrieving http://localhost/prestashop/. It may be down for maintenance or configured incorrectly.

没有特定的文件可以触发此操作。但是我看到通常由 4-5 个 php 文件组成的小程序运行良好,但文件很多的软件(如 PrestaShop)却不行。
我检查了日志,这就是我发现的。

[Wed Mar 16 19:33:39 2011] [error] [client ::1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Mar 16 19:33:39 2011] [error] [client ::1] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/yomig/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
[Wed Mar 16 19:33:39 2011] [error] [client ::1] File does not exist: /var/www/html/favicon.ico
[Wed Mar 16 19:33:41 2011] [error] [client ::1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Mar 16 19:33:41 2011] [error] [client ::1] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/yomig/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

最佳答案

遇到同样的错误,对我来说这是因为在我的 Mac 上我已将 DocumentRoot 更改为我的用户站点目录。

为了修复它,我运行了递归命令以确保 Apache 服务具有读取权限。

sudo chmod -R 755 ~/Sites

关于PHP 警告 : Unknown: failed to open stream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5326531/

相关文章:

PHP While 从数组循环

PHP - 计算 MySQL 查询中的元素返回双倍的元素数

php - 使用 PHP 从数据库中获取 Blob 并将其用于 HTML 标记

java - 如何根据 URL 中的_escaped_fragment_ 重定向到 Tomcat?

mysql - 使用 apache 网络服务器从 perl 连接到 mysql?

java.lang.ArrayIndexOutOfBoundsException : 2 error in mapreduce, Hadoop

java - 将 RTF 文件转换为 DOC

php - 在 PHP 中通过 GSM 调制解调器建立和接听电话

apache - Symfony2 : redirect localhost/app_dev. php 到 localhost/

javascript - 在 20 个页面的网站的所有页面中包含一个通用的 html 标题(具有事件类)