Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Update WordPress Permission Denied /class-wp-filesystem-direct.php

Discussion in 'Misc WordPress Requests' started by bdotmall, Jan 19, 2018.

  1. bdotmall


    Reply To: Update WordPress Permission Denied /class-wp-filesystem-direct.php, by bdotmall


    I had the same issues and finally found something else that got it fixed, so I figured I’d share…

    I found the define(‘FS_METHOD’, ‘direct’); trick, but still had the “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…” issue.

    I made sure my web service had access (I’m running CentOS 7 in a Virtualbox):
    chown -R apache:apache /var/www

    Again, on the last line of /var/www/html/wp-config.php, I added:
    define(‘FS_METHOD’, ‘direct’);

    I then temporarily updated all permissions on files and directories to 777:
    find /path/to/site/ -type f -exec chmod 777 {} \;
    find /path/to/site/ -type d -exec chmod 777 {} \;

    HERE’S THE TRICK: I found somewhere that SELinux was causing problems and the solution was to run:
    chcon -R –type httpd_sys_rw_content_t /var/www/html/

    I restarted my web service (systemctl restart httpd).

    Then logged into WordPress and ran the system update and it worked!

    Once the update finished, I went back and “fixed” the permissions to recommended settings:
    find /path/to/site/ -type f -exec chmod 0664 {} \;
    find /path/to/site/ -type d -exec chmod 0775 {} \;

    I pulled my hair out for hours on this, so hope it helps someone else too. Thanks to the community for sharing their knowledge and constantly helping me out when I’m in a jam!


    Reply To: Update WordPress Permission Denied /class-wp-filesystem-direct.php

Share This Page

Monarch Social Sharing Plugin