大网数据广告活动
服务器运维问答

Wordpress plugin update/install failure

· 52CE 我爱测

I've been reading all sorts of information all over the web on this topic. I just installed Wordpress on my Fedora 22 box, x64. The installation went perfectly, I'm able to access the site, but cannot update plugins at all. I've …

问题原文

原帖链接 · MrAureliusR · CC BY-SA 3.0

I've been reading all sorts of information all over the web on this topic. I just installed Wordpress on my Fedora 22 box, x64. The installation went perfectly, I'm able to access the site, but cannot update plugins at all.

I've seen two different directions so far:

1) Set up the FTP server that it's asking for, and give it the proper login authentication details

I started to go in this direction, but really hit a brick wall when it wouldn't accept the proper credentials.

Then, in an old Stack Overflow post, I found

2) Add define('FS_METHOD', 'direct'); to wp-config.php

Both of these problems are around filesystem permissions problems. I've tried changing the owner of /var/www/html. During the setup (in which I followed the instructions here) the instructions said to set the ownership and group to apache:apache. It also says to change the SELinux policy for those directories. I have tried changing the ownership to a few different things, including my user, www-data, www_data, and all the other things people suggest around the web. However, nothing changed, until I added the above line to wp-config.php. It no longer asks for FTP credentials, but it still fails, and it's still almost certainly because of permissions.

Many articles said to change the ownership to whichever user was running the php or php-fpm processes -- but those are not running! Tried ps aux | grep php and also tried that with sudo, but the only result it shows is the grep process looking for php.

I'm at a bit of a roadblock here: should I backtrack, and try the FTP direction again, or is there another way to solve the permissions issue? I'm not even sure which folder it's trying to create when it updates or installs a plugin. I did a sudo find / -name wordpress to see if there were other folders outside /var/www/html, the only others that had the wordpress name in them were the mysql directories.

Also, I'm not sure if this is the right place for this post, but it seemed to be the most logical (as it related to a Wordpress/Apache server and not just Unix/Linux itself) but feel free to move it if I've placed it incorrectly.

Thanks for any help you can give.

EDIT: Also tried adding this define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) ); to wp-config, as recommended on the WP website. Didn't work, and removed it, as also recommended. Also tried changing define('FS_METHOD', 'ftpsockets'); and of course it is asking for my FTP creds again. I can access the FTP from my laptop, but when I try those same credentials from the WP interface, it says it can't connect. Tried changing hostname to localhost:22 (as it didn't automatically change to port 22 when I picked SFTP), tried regular FTP (which is also open, temporarily), tried the IP, haven't tried 10.0.0.1 or whatever the localhost IP is. Really banging my head against the proverbial wall.

已采纳解答

原帖链接 · MrAureliusR · CC BY-SA 3.0

It turned out to be an SELinux access problem. I somehow missed it because the SELinux Troubleshooter usually pops up a notification if it blocks something. I had to go in and check manually.

The problem occurred because this command in the tutorial wasn't right:

chcon -Rt httpd_sys_content_t /var/www/html

It should be

chcon -Rt httpd_sys_rw_content_t /var/www/html

Changing that immediately resolved it! This was with

define('FS_METHOD', 'direct');

still in wp-config.php.

A huge thanks to s1lv3r, who helped me greatly through the troubleshooting process!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。