Search code examples
wordpresspermissions

Update Wordpress file permissions owner


I have problem with update Wordpress from dashboard because I have been seeing information The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

When I change directories owner wp-admin and wp-includes to apache I can use wordpress update from dashboard but how do I set correct permissions and owner as I don't want to always change owner of these directories when I need to update wordpress.

chown -R username:username /path/to/site
chown -R apache:apache /path/to/site/wp-content
find /path/to/site/ -type d -exec chmod 775 {} \;
find /path/to/site/ -type f -exec chmod 664 {} \;
sudo chmod 660 wp-config.php

Solution

  • All your WordPress files, not just the ones in wp-content, must be owned by the web server user ("apache" in your case) for upgrades to succeed from the dashboard UI. You set most of them to be owned by the interactive user; that's incorrect.

    If you use wp-cli, say

    sudo -u apache wp update
    

    so it will run with the correct permissions.