• Resolved rozard

    (@rozard)


    Hi Community, I’m unable to upload images, can’t install plugins, and can’t update WordPress. I keep getting permission errors. Such when I tried to update WordPress, I got the error “Could not create directory.: /var/www/html/wordpress/wp-content/upgrade”. When I tried to install a plugin, I got the error “Installation failed: Could not create directory. /var/www/html/wordpress/wp-content/upgrade”. When I tried to upload an image which is 500KB, I got an error “Unable to create directory wp-content/uploads/2023/12. Is its parent directory writable by the server?”. Apache user and group are the owners of /var/www/html/wordpress and all of its content. The user and group both have read, write, and execute permission to all of the content. Any idea what’s going on?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Your PHP-FPM user and group could be different, assuming that you are using it.

    Hi @rozard,

    As you have mentioned, you have set the correct permissions under ‘/var/www/html/wordpress’?directory. Please verify you have set the correct permission recursively to subdirectories as well. You can double-check the steps here: https://www.wpbeginner.com/beginners-guide/how-to-fix-file-and-folder-permissions-error-in-wordpress/

    If needed, you can contact your hosting provider to check server-side permissions.

    Best regards,
    Niko

    To resolve this, ensure that the wp-content/uploads directory and its parent directories have the correct ownership. The Apache user (commonly www-data or apache) should be the owner of these directories. You can use the following command in the terminal:

    sudo chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads

    This recursively changes ownership to the Apache user. After applying this command, try uploading images, installing plugins, and updating WordPress again. If the issue persists, check the file and folder permissions to ensure that they are set to allow the Apache user to read, write, and execute. You can use the following command:


    sudo chmod -R 755 /var/www/html/wordpress/wp-content

    For further explanation you can go through the wpbeginner article:https://www.wpbeginner.com/beginners-guide/how-to-fix-file-and-folder-permissions-error-in-wordpress/

    Thread Starter rozard

    (@rozard)

    Thank you all for trying to help me. I fixed the issue. It was related to SELinux. For some reason, I didn’t think about the SELinux context earlier. It was the first time I installed WordPress on Linux. I’m still looking around and figuring out how things work with Linux. Since I installed WordPress, I have encountered two issues, which I fixed. This was the second one. Now, I have a question about checksum, which I need help to figure out, but I’ll create a separate post about it. Here is the command I ran that fixed the issue. It may help someone else if they have a similar issue.

    # chcon -R -t httpd_sys_rw_content_t /var/www/html/wordpress
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How fix directory permission issue?’ is closed to new replies.