【问题标题】:Failed opening sunrise.php for inclusion未能打开 sunrise.php 以供包含
【发布时间】:2013-10-30 07:38:37
【问题描述】:

所以我收到了这个错误:

Warning: include_once(/var/www/wp-content/sunrise.php): failed to open stream: Permission denied in /var/www/wp-includes/ms-settings.php on line 18

Warning: include_once(): Failed opening '/var/www/wp-content/sunrise.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/wp-includes/ms-settings.php on line 18

我认为文件 sunrise.php 不存在...它存在。
我认为权限是错误的......他们不是(为了安全起见,我去了 777)。

我没有想法。为什么ms-settings.php 看不到sunrise.php?这绝对是它应该在的地方:/var/www/wp-content/sunrise.php

(如果我删除sunrise.php,我只会得到一个空白屏幕,没有警告/错误,什么都没有)。

这是我的 wp-content 文件夹的ls -l

drw-r--r-- 4910 apache apache 81920 Oct  7 17:42 blogs.dir
-rw-r--r--    1 apache apache  3304 Oct 21 15:10 blog-suspended.php
drwxrwxr-x    4 apache apache  4096 Sep 23 20:43 documents
-rw-r--r--    1 apache apache    30 Oct 21 15:10 index.php
drwxrwxr-x   31 apache apache  4096 Oct 21 15:10 plugins
-rwxrwxrwx    1 apache apache  1559 Oct 21 15:10 sunrise.php
drwxrwxr-x    8 apache apache  4096 Oct 21 15:10 themes
drwxr-xr-x    2 apache apache  4096 Oct  3 16:06 upgrade
drwxr-xr-x    7 apache apache  4096 Oct  2 16:10 uploads

有什么想法/想法吗?

【问题讨论】:

  • 你说sunrise.php在正确的位置。只是为了确认一下,那个 wp-content 文件夹上的“pwd”返回了什么?
  • @lwitzel:它返回“/var/www”
  • 等等,当你在上面显示的 wp-content 目录中时,“pwd”返回“/var/www”?
  • 另外,wp-content文件夹的权限是什么?你可以运行“ls -al”来查看它...
  • 对不起,不,我的错误@lwitzel。它是“/var/www/wp-content”。该文件夹的权限是 rw-r--r--... 我会尝试增加它们。

标签: php wordpress permissions


【解决方案1】:

也许 apache 正在一个被监禁的环境中运行。 如果你把它放进去,你会得到什么:

echo realpath(dirname(__FILE__));

您是否尝试过进行相对包含(即 ../)

【讨论】:

  • 我把它放在ms-settings.php 文件中,并按预期得到了'/var/www/wp-includes'。更改为相对包含更改将错误消息中的路径更改为“../wp-content/sunrise.php”。还有其他想法吗?
【解决方案2】:

尝试将 sunrise.php 文件下移一级,以“上传”。

【讨论】:

  • 将其提升一个级别(并调整 include_once 以反映这一点)解决了该问题。我不知道为什么(wp-content 应该在哪里),但它就是这样。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-06-17
  • 2014-09-27
  • 1970-01-01
  • 1970-01-01
  • 2016-01-21
  • 2019-12-23
  • 1970-01-01
相关资源
最近更新 更多