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.
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!
I've often faced this issue even with the correct file permissions. My solution that usually resolves this is by simply disabling all plugins/theme and only updating that one specific plugin.