将php56w从5.6.31更新到5.6.35后,Wordpress文件权限被破坏

时间:2018-05-07 17:53:37

标签: php wordpress apache fastcgi

上周五,我将我的Wordpress博客的php安装从php 5.6.31更新为php 5.6.35。该博客正在使用FastCGI和Apache来提供流量,服务器正在运行CentOS 7.自升级以来,Wordpress文件权限似乎被打破了。我无法将文件上传到博客条目,更新插件或更新Wordpress本身。

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

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历史撤销[x]对我不起作用,所以我想我可能需要很难解决这个问题。

感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:0)

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