0

I have some WordPress websites server with root access, and at the time of creating the server, everything was fine and WordPress itself and plugins and themes were updating without any issues, but I'm not sure why recently I got an error indicates usually permission error (at least I see permissions are fine).

Error when updating WordPress:

Downloading update from https://downloads.wordpress.org/release/fa_IR/wordpress-5.7.zip…

The authenticity of wordpress-5.7.zip could not be verified as no signature was found.

Unpacking the update…

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

Installation failed.

These are what I did to investigate the problem:

ls -ld /home
drwx--x--x 26 root root 4096 Mar 9 20:03 home
ls -ld /home/my_user
drwx--x--x 26 my_user my_user 4096 Mar 9 20:03 /home/my_user/
ls -ld /home/my_user/public_html
drwxr-x--- 26 my_user nobody 4096 Mar 9 20:03 /home/my_user/public_html/

Also all of the files inside public_html permissions are 0644, and all directories are 0755.

cd /home/my_user/public_html/
find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;
find . -type f -exec chown my_user:my_user {} \; && find . -type d -exec chown my_user:my_user {} \;

The result of lsattr is as below:

lsattr /home/my_user/public_html/wp-admin/includes/update-core.php
-------------e-- /home/my_user/public_html/wp-admin/includes/update-core.php

So till now, there's nothing wrong with permissions and ownership in my opinion.

Checking wp-admin, wp-admin/includes and wp-admin/includes/update-core.php permissions and ownership was fine and had no problem, but I'm not sure why WordPress cannot install any plugin, theme or itself.

PHP-Handler is suphp (I also ran it with cgi and lsapi) but nothing changed in this regard.

Apache configuration is as below:

MPM: mod_mpm_prefork
Apache modules (some of them):
mod_cgi
mod_lsapi
mod_mpm_prefork
mod_suexec
mod_suphp

I should mention that I have created a file like info.php and executed in the web browser, it's fine. Then I chowned to like root:root and in the second case I get 403 error (that's expected), then I reverted it again to my_user:my_user

Apache group is nobody I think, and public_html directory's chown is my_user:nobody. So my website and other websites work fine, but the only issue is when updating or even trying to install a plugin/theme/new update.

I've checked the log files but nothing were logged.

4
  • Is this happening in the browser, or are you using wp-cli to update WordPress?
    – Pat J
    Mar 18, 2021 at 20:34
  • I use web browser
    – Saeed
    Mar 18, 2021 at 20:49
  • What process does your webserver run as? Is it my_user or is it something like www-data or apache or httpd? If it's not my_user then that'd be why WordPress can't replace the files.
    – Pat J
    Mar 18, 2021 at 21:38
  • It's my_user when I run top and see lsphp's user
    – Saeed
    Mar 19, 2021 at 8:06

1 Answer 1

6

I solved this by making the webserver user the owner and the group of all the files in the WordPress directory.

I figured out the webserver user was daemon with:

ps aux | egrep '(apache|httpd)'

Then I changed the permissions with:

sudo chown -R daemon:daemon /your-path-to-wordpress
2
  • Thanks, but I reinstalled the OS and now everything is working fine, but that did not solve my problem because I have tried it
    – Saeed
    Apr 17, 2021 at 17:24
  • wow, searching the web and this seems to worked for me too on Xampp Mac without even checking webserver user: sudo ........daemon:daemon /wordpress-folder thanks you
    – alex
    Jan 12, 2022 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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