I have read that it may be a permissions problem, but I did “chown -R apache:apache *” in /var/www/html and checked that my httpd is running as apache.
Triple check the ownership of the files created by WordPress, the easiest way to do that is to upload an image and check the ownership (including group) of the wp-content/uploads/….filename file and make everything else match that. It will probably be apache:apache here, but if you’re using PHP-fpm it can differ
Thread Starter
ulim
(@ulim)
Thanks for the tip with uploading an image, I can’t get that to work either:
Unable to create directory wp-content/uploads/2020/12. Is its parent directory writable by the server?
So this appears to point to a permission error, but I checked that /var/www/html and wp-content and uploads all have 755. All directories are owned by apache:apache and httpd is running as apache.
Also, I can create directories as user apache by way of:
sudo -S -u apache mkdir wp-content/uploads/testdir
So there seems to be something else broken. I’m using a pre-baked LEMP image from my hosting provider.
Thread Starter
ulim
(@ulim)
Wordpress also cannot write to my .htaccess file, even though it’s writable for user apache.
Thread Starter
ulim
(@ulim)
Ok, I can shed some light on this issue, but still need some help.
After chmod 777 to the uploads directory and .htaccess file, I could write to both. Interestingly, after resetting the permissions to normal, I could still write to both. So I was able to upload a picture and it does not have owner apache, but php-fpm.
That seems to me horribly dangerous. How can I fix that?