How are you hosting your site?
What did you change?
Hi Steve,
I hosting my site on a Red Hat Linux on which I have set up a LAMP stack server. I read in a blog that changing access permission would fix the file upload error and followed the steps provided in links 1 and 2(mentioned in my question).
I feel the 500 error that I am getting now, is due to the permissions I have set up. I have taken screenshots to show. But can I upload images in this forum or is there another way to show them?
Here is the link for the screenshot of my access permissions that I have set,
Link1
Link2
What is the user under which PHP is running? The file tree in which you’ve installed WordPress must be owned by that user.
ps -ef |grep php if you’re using php-fpm. Otherwise, the owner should probably be ‘apache’. Also, if you have SELinux activated, you need to ensure that the SELinux permissions are correct, too.
Permissions should be 755/644.
When I run this command ps -ef |grep php, its says PHP is running under root user. Also I checked(cat /etc/sysconfig/selinux) SE Linux is in enforcing state, but how do I change them to 755/644??
SELinux and file permissions are not related.
This isn’t the place for Linux sysadmin training, but I do recommend that you use php-fpm rather than a straight LAMP stack.
https://wp-root.org/server/install-php-fpm-tcp-unix-sockets-centos/
I executed this command
find . type f -exec chmod 644 {} \;
and the 500 error page is not being displayed now. I am able to view my web page.
But I am still unable to upload a background image. (same error appears “Unable to create directory wp-content/uploads/2018/05. Is its parent directory writable by the server?”)
what is the ownership and permissions of the parent directory?
The directory in which I have my WordPress theme is rr.
My permissions are
/var/www – rwxr-xr-x (owner-root)
/var/www/html – rwxr-xr-x (owner-root)
/var/www/html/rr – rwxr-xr-x (owner-nobody)
/var/www/html/rr/wp-content – rwxr-xr-x (owner-nobody)
make the it all owner:owner where owner is the same user under which PHP is running.
@sterndata
Thanks for the help Steve. I am able to upload the images to my WordPress without any issues! :))