• Installed WordPress 4.9.8 and wordpress would like to update to 5.0. When I tried to perform the update I get the connection information request. I was able to update plugins and themes ok. After looking around I performed the following:

    Wordpress install in running on Centos 7 with SELinux enabled.
    I installed WordPress from a targz.
    I set owner:grp to apache directories to 755, files to 644 except wp-config.php with is 640.
    I set wp-content and contents as well as wp-config.php context to httpd_sys_rw_content_t.
    I added define(‘FS_METHOD’,’direct’); to the end of wp-config.php

    After doing all that I am still unable to upgrade.
    I noticed at directory in my wp-content/uploads directory 2018. I deleted it but it has not been recreated. At some point WordPress created that directory because I created the uploads directory empty when I installed WordPress.

    I am now wondering if I have you perform some sort of manual upgrade.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    The files must be *owned* by the same user under which PHP is running, with permissions 755/644. If you’re using php-fpm, then that’s not “apache”.

    Thread Starter whitemw

    (@whitemw)

    Ok I checked the user by coding a php file: <?php echo exec(‘whoami’); ?>
    and ‘apache’ was the answer. So still looking.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    ownership is “apache:apache”?

    Thread Starter whitemw

    (@whitemw)

    After more looking I changed my php program to:

    <?php echo exec(‘whoami’);
    print “<br>”;
    print get_current_user ();
    ?>

    The result was:
    apache
    root

    So I changed the owner to root. No change still wants connection info.

    Thread Starter whitemw

    (@whitemw)

    ownership is now root:apache

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Run that PHP file from WordPress, not from the command line!

    WordPress *does not* or at least should NEVER run as root.

    Use PHP-FPM and configure PHP to run as a non-privileged user with no shell, that is used on only one web site.

    https://wp-root.org/server/install-php-fpm-tcp-unix-sockets-centos/

    Thread Starter whitemw

    (@whitemw)

    Was apache:apache

    Thread Starter whitemw

    (@whitemw)

    Ok checked ownership in update-core.php which is the file in control during failure. Both functions report apache as the owner now. Changed the owner back to apache:apache. No change of course. Hoping to figure this out without having to instrument a bunch of code.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Let’s go back to selinux — anything in the selinux logs?

    Quick test — change SELinux to permissive mode and see if that helps:

    from the command line sudo setenforce permissive

    Thread Starter whitemw

    (@whitemw)

    Ok da this php-fpm went over my head completely, thinking rpm typo. I have run WordPress on my local server and never needed this package. Will have to research. So I don’t have php-fpm installed and have not seen any install instructions calling for it. Can you elaborate as to why it is needed and do you have experience with it fixing my issue.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    php-fpm lets you closely control the PHP user; if you’re running multiple sites on a server, it lets you run each as a different user so a hack of one cannot touch any of the others.

    I’m thinking your issue may be SELinux. Did you try setting it to permissive?

    Thread Starter whitemw

    (@whitemw)

    Ok agree with the SELinux theory. I have not set SELinux to permissive, and don’t want to. I already set the wp-content directory to a rw context and am able to update plugins and themes. So since I can’t update to 5.0 I’m thinking at least wp-admin directory needs its context changed to httpd_sys_rw_content_t. Have not had a chance to do research on directories updated. I have checked the SELinux logs but nothing, which does not surprise me because I think WP is just checking for authorization which might not create a log entry. At this point I really want to know what is blocking me and make sure I make the correct change. Going to review the code and instrument it to get the exact location it can’t write to. Took a quick look at the link you supplied regarding php-fmp. Seems like your saying it allows me to separate update permissions for WP from apache.

    Will post my results after I come to a conclusion. I might have some more questions later.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    OK. These forums are not really the place for SELinux support. Look at the seaudit logs and tools and do a lot of Googling.

    Thread Starter whitemw

    (@whitemw)

    SOLVED
    I’ve completed my testing and have the answers I was looking for. I started this post because I was unable to upgrade my WordPress site automatically. Everything I found mentioned updating Plugins and Themes and not specifically Upgrades. Having a Centos 7 site with SELinux I knew SELinux could be blocking update permissions. I am mentioning SELinux because it is the problem not because I looking for SELinux solutions. As mentioned earlier I changed the context for the wp-content directory to rw and that worked for Plugins and Themes but not Upgrades. After examining the code it turns out that the sites root directory is the one tested for authorization. That means that the rw context must be applied to the entire WP directory structure to pass the test. For some that may be ok, I will choose to manually upgrade my site. The php-fpm is a solution to isolate updates from the apache user and is an interesting isolation mechanism that I was unaware of, thanks for bringing it up.

    To restate, if running SELinux you will have to set a context of httpd_sys_rw_content_t to your complete WP site to perform upgrades from the web. You can get away with setting this context to wp-content if you only want update/add Themes and Plugins from the web interface. In addition, you will need the correct file permissions and ownership also.

    Steven thank you for you good comments, you were very helpful and professional.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Update requires connection information’ is closed to new replies.