1

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.

  • Yeah, you are already on the right track. You need to find out, under which user your PHP script gets executed, to then set the needed permissions. You can try $processUser = posix_getpwuid(posix_geteuid()); print $processUser['name']; in a PHP script to get the user name. – s1lv3r Mar 30 '16 at 17:55
  • I'm far from a PHP user. How can I run that? – Aurelius Mar 30 '16 at 18:01
  • Put it into a .php file and then access it via the browser just like you do with your WordPress install. :| – s1lv3r Mar 30 '16 at 18:02
  • Just tried that, as I remember I did the phpinfo() thing in info.php. However, replacing that with the code you mentioned generated a 500 server error. – Aurelius Mar 30 '16 at 18:03
  • Just put it exactly the way as in that page (scroll down to the first comment): php.net/manual/en/function.get-current-user.php – s1lv3r Mar 30 '16 at 18:05
1

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!

0

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.

  • This is a brand new install, with no themes or plugins installed besides the default Akismet, which I'm trying to update. – Aurelius Mar 30 '16 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.