Unable to update WordPress due to incorrect file permission

I am getting error while updating plugin. This is Oracle Linux Arm Ampere instance.

An error occurred while updating Akismet Anti-Spam: Could not create directory.

I have applied following permission on files and folders.

sudo chown -R nginx:nginx /var/www/mysite/html
sudo find /var/www/mysite/html -type d -exec chmod 755 {} \;
sudo find /var/www/mysite/html -type f -exec chmod 644 {} \;

I have another WordPress site on VirMach VPS with same permission and there it updates fine. Here's result of ls -l

[opc@arm html]$ ls -l
total 212
-rw-r--r--  1 nginx nginx   405 Feb  6  2020 index.php
-rw-r--r--  1 nginx nginx 19915 Jan  1  2022 license.txt
-rw-r--r--  1 nginx nginx  7401 Mar 22 21:11 readme.html
-rw-r--r--  1 nginx nginx  7165 Jan 21  2021 wp-activate.php
drwxr-xr-x  9 nginx nginx  4096 Jul 12 16:16 wp-admin
-rw-r--r--  1 nginx nginx   351 Feb  6  2020 wp-blog-header.php
-rw-r--r--  1 nginx nginx  2338 Nov  9  2021 wp-comments-post.php
-rw-r--r--  1 nginx nginx  3230 Aug 18 17:53 wp-config.php
drwxr-xr-x  4 nginx nginx    52 Jul 12 16:16 wp-content
-rw-r--r--  1 nginx nginx  3943 Apr 28 09:49 wp-cron.php
drwxr-xr-x 26 nginx nginx 12288 Jul 12 16:16 wp-includes
-rw-r--r--  1 nginx nginx  2494 Mar 19 20:31 wp-links-opml.php
-rw-r--r--  1 nginx nginx  3973 Apr 12 01:47 wp-load.php
-rw-r--r--  1 nginx nginx 48498 Apr 29 14:36 wp-login.php
-rw-r--r--  1 nginx nginx  8577 Mar 22 16:25 wp-mail.php
-rw-r--r--  1 nginx nginx 23706 Apr 12 09:26 wp-settings.php
-rw-r--r--  1 nginx nginx 32051 Apr 11 11:42 wp-signup.php
-rw-r--r--  1 nginx nginx  4748 Apr 11 11:42 wp-trackback.php
-rw-r--r--  1 nginx nginx  3236 Jun  8  2020 xmlrpc.php

Site Health in WordPress says:

Shows whether WordPress is able to write to the directories it needs access to.

The main WordPress directory    Not writable
The wp-content directory    Not writable
The uploads directory   Not writable
The plugins directory   Not writable
The themes directory    Not writable

But the other site on VirMach VPS says these folders are writeable.

SELinux is disabled.

Comments

  • bikegremlinbikegremlin ModeratorOG

    Before someone who actually knows anything offers a solution (and/or corrects me), did you try re-setting the permissions a bit higher up the directory hierarchy (provided that doesn't affect security in a bad way)?

    How's Akismet working for you - beside the update problem?

    Detailed info about providers whose services I've used:
    BikeGremlin web-hosting reviews

  • @bikegremlin said:
    Before someone who actually knows anything offers a solution (and/or corrects me), did you try re-setting the permissions a bit higher up the directory hierarchy (provided that doesn't affect security in a bad way)?

    How's Akismet working for you - beside the update problem?

    Ok after much trial and error I managed to fix the issue. I compared www.conf of both VPS and noticed the following:

    Debian 11 on VirMach
    sudo nano /etc/php/8.1/fpm/pool.d/www.conf
    user = www-data
    group = www-data

    Oracle Linux 8 on Oracle Cloud
    sudo nano /etc/php-fpm.d/www.conf
    user = apache
    group = apache

    Aha so the user is actually apache and not nginx as I thought. So running following command fixed the issue.

    sudo chown -R apache:apache /var/www/mysite/html

    Thanked by (1)bikegremlin
  • vyasvyas OGRetired
    edited August 2022

    Why not a standard user “www-data” or “website?”

    Edit:
    Based on response below,
    Maybe CentOsWebPanel might be a better fit. Debian I would have recommended Webinoly - best wishes

  • @vyas said:
    Why not a standard user “www-data” or “website?”

    Because apache is defined in Oracle Linux 8 in phpfpm config. I can try to change it to www-data but it may require some extra work fiddling with permission as I am a Linux noob.

  • vyasvyas OGRetired
    edited August 2022

    Are you alilet on LET? Questions seem the same on both forums.
    You have mentioned your Server OS as Debian11. Here you mention Oracle Linux 8.
    What OS exactly are you using or planning to use?

    Thanked by (1)lesuser
  • @vyas said:
    Are you alilet on LET? Questions seem the same on both forums.
    You have mentioned your Server OS as Debian11. Here you mention Oracle Linux 8.
    What OS exactly are you using or planning to use?

    Yeah. Debian 11 is VirMach VPS. Oracle Linux is Arm Ampere for which I posted this issue.

  • vyasvyas OGRetired

    @lesuser said:

    @vyas said:
    Are you alilet on LET? Questions seem the same on both forums.
    You have mentioned your Server OS as Debian11. Here you mention Oracle Linux 8.
    What OS exactly are you using or planning to use?

    Yeah. Debian 11 is VirMach VPS. Oracle Linux is Arm Ampere for which I posted this issue.

    I had suggested CWP (Centos web panel) which will not work afaik. See if Ajenti works. If your end goal is WordPress, then you should be focusing on WP management, not server admin :-)
    See if any of these projects have an arm equivalent

    http://docs.ajenti.org/en/latest/man/install.html

    http://docs.sentora.org/?node=7

    Thanked by (1)lesuser
  • Oracle Linux is similar to Fedora, FWIW - Some (Most?) tutorials for Fedora should work on Oracle Linux as well.

    Failing that, Ubuntu is available for ARM instances on Oracle Cloud.

    Cheap dedis are my drug, and I'm too far gone to turn back.

Sign In or Register to comment.