Since you posted this in localhost and stated it was a localhost installation, I’ll assume that’s what you have.
This issue is being caused by an ancient Apache/PHP configuration where PHP does not run as the owner of the front-facing filesystem. There are two ways to fix this. The best is to change the Apche and PHP configurations so PHP runs as FastCGI, preferably using PHP-FPM. There are many online guides to help you install and set up PHP-FPM.
The second is to change the Apache configuration so it runs as the owner of the front-facing filesystem. This is the easier method of the two, but it requires a localhost/LAN setup. First, locate and edit your Apache configuration. You should find a line that looks something like this:
Listen 0.0.0.0
Change it to look like this:
Listen 127.0.0.1
If you are on a LAN, you can also use the local IP address assigned by the LAN to your system. Next, find two lines that look something like this:
User www-data
Group www-data
The www-data
entries could also be values like nobody
or apache
. You’ll want to change both values to the user that owns your front-facing filesystem. Now save the file(s) and restart Apache, and your problem should be fixed. If everything works correctly, you can restore the permissions of the WP files/directories to 0644 and 0755.
If you are not a localhost or LAN setup, the above changes will break your site. If that happens, restore the original values, restart Apache, and use the first method instead.