Hi all I\'m using PHP for my website and ubuntu linux on my system. I got the above error in error.log file of apache, even after configurating everything properly. I did a
I had the same issue when I changed the home directory of one use. In my case it was because of selinux
. I used the below to fix the issue:
selinuxenabled 0
setenforce 0
I have also got stuck into this and believe me disabling SELinux is not a good idea.
Please just use below and you are good,
sudo restorecon -R /var/www/mysite
Enjoy..
If it gets into the selinux arena you've got a much more complicated issue. It's not a good idea to remove the selinux protection but to embrace it and use the tools that were designed to manage it.
If you are serving content out of /var/www/abc
, you can verify the selinux permissions with a Z
appended to the normal ls -l
command. i.e. ls -laZ
will give the selinux context.
To add a directory to be served by selinux you can use the semanage
command like this. This will change the label on /var/www/abc
to httpd_sys_content_t
semanage fcontext -a -t httpd_sys_content_t /var/www/abc
this will update the label for /var/www/abc
restorecon /var/www/abc
This answer was taken from unixmen and modified to fit this question. I had been searching for this answer for a while and finally found it so felt like I needed to share somewhere. Hope it helps someone.
Make sure that the htaccess file is readable by apache:
chmod 644 /var/www/abc/.htaccess
And make sure the directory it's in is readable and executable:
chmod 755 /var/www/abc/