【问题标题】:Wordpress file permissions broken after updating php56w from 5.6.31 to 5.6.35将 php56w 从 5.6.31 更新到 5.6.35 后,Wordpress 文件权限被破坏
【发布时间】:2018-10-17 14:16:56
【问题描述】:

上周五,我将我的 Wordpress 博客的 php 安装从 php 5.6.31 更新到 php 5.6.35。该博客使用 FastCGI 和 Apache 服务流量,服务器运行 CentOS 7。升级后,Wordpress 文件权限似乎被破坏。我无法将文件上传到博客条目、更新插件或更新 Wordpress 本身。

起初,尝试升级 Wordpress 提示我输入 FTP 凭据,这是我过去从未使用过的。所以我在我的 wp-config.php 中添加了define('FS_METHOD', 'direct');。这取得了进展,但我收到了暗示文件权限问题的错误,即使据我所知,它们是正确的。

wordpress 的所有文件都在/var/www/html 中,归apache:apache 所有。文件主要是 0644,文件夹是 0755,自更新以来它们都没有改变。 httpd 作为 apache 运行,php-fpm 也是如此。尝试更新 wordpress 本身显示:

Downloading update from https://downloads.wordpress.org/release/wordpress-4.9.5-no-content.zip…

Unpacking the update…


Warning: copy(/var/www/html/wp-admin/includes/update-core.php): failed to open stream: Permission denied in /var/www/html/wp-admin/includes/class-wp-filesystem-direct.php on line 243
The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Installation Failed

我想知道 php 升级是否以某种方式改变了 php 配置,从而破坏了 php 访问博客的方式。尽管每个错误都表明它是文件权限,但它看起来不像是文件权限。比如我可以sudo -u apache touch /var/www/html/wp-admin/includes/test就好了。

这就是我的/etc/httpd/conf.d/php.conf 的样子:

# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

#AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path    "/var/lib/php/session"
#php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"

这里是 yum 交易:

Updated php56w-5.6.31-1.w7.x86_64          @webtatic
Update         5.6.35-1.w7.x86_64          @webtatic
Updated php56w-bcmath-5.6.31-1.w7.x86_64   @webtatic
Update                5.6.35-1.w7.x86_64   @webtatic
Updated php56w-cli-5.6.31-1.w7.x86_64      @webtatic
Update             5.6.35-1.w7.x86_64      @webtatic
Updated php56w-common-5.6.31-1.w7.x86_64   @webtatic
Update                5.6.35-1.w7.x86_64   @webtatic
Updated php56w-dba-5.6.31-1.w7.x86_64      @webtatic
Update             5.6.35-1.w7.x86_64      @webtatic
Updated php56w-devel-5.6.31-1.w7.x86_64    @webtatic
Update               5.6.35-1.w7.x86_64    @webtatic
Updated php56w-fpm-5.6.31-1.w7.x86_64      @webtatic
Update             5.6.35-1.w7.x86_64      @webtatic
Updated php56w-gd-5.6.31-1.w7.x86_64       @webtatic
Update            5.6.35-1.w7.x86_64       @webtatic
Updated php56w-intl-5.6.31-1.w7.x86_64     @webtatic
Update              5.6.35-1.w7.x86_64     @webtatic
Updated php56w-mbstring-5.6.31-1.w7.x86_64 @webtatic
Update                  5.6.35-1.w7.x86_64 @webtatic
Updated php56w-mcrypt-5.6.31-1.w7.x86_64   @webtatic
Update                5.6.35-1.w7.x86_64   @webtatic
Updated php56w-opcache-5.6.31-1.w7.x86_64  @webtatic
Update                 5.6.35-1.w7.x86_64  @webtatic
Updated php56w-pdo-5.6.31-1.w7.x86_64      @webtatic
Update             5.6.35-1.w7.x86_64      @webtatic
Updated php56w-process-5.6.31-1.w7.x86_64  @webtatic
Update                 5.6.35-1.w7.x86_64  @webtatic
Updated php56w-soap-5.6.31-1.w7.x86_64     @webtatic
Update              5.6.35-1.w7.x86_64     @webtatic
Updated php56w-xml-5.6.31-1.w7.x86_64      @webtatic
Update             5.6.35-1.w7.x86_64      @webtatic

如果它实际上是由 php 升级引起的配置更改引起的,是否有人对我如何尝试解决此问题有任何想法?不幸的是,yum history undo [x] 对我不起作用,所以我想我可能需要通过艰难的方式解决这个问题。

感谢您提供的任何帮助。

【问题讨论】:

    标签: php wordpress apache fastcgi


    【解决方案1】:

    问题是由 SELinux 引起的。 sudo setenforce permissive 解决了这个问题,所以我需要修复策略。

    【讨论】:

      猜你喜欢
      • 2018-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-06
      • 2017-02-23
      • 1970-01-01
      • 2013-05-19
      相关资源
      最近更新 更多