I have installed CentOS 7 with Apache Web Server and PHP. But when I try to test php I’ve got this error
The user and group of info.php are “apache”
My Document Root is defined like you can see:
If I try to access with http://localhost it works, but when I try to access with http://localhost/info.php then it fails!!!
I have installed php and php-fpm package. Maybe Would I need other packages?
What am I doing wrong?
Edit I:
Looking for an error in access_log file I have found this error:
Why I get this error?
Edit II:
Looking for in error_log file I have found that is a problem of permissions:
[Tue Jul 24 18:44:21.084670 2018] [mime_magic:error] [pid 4986] [client ::1:38162] AH01512: mod_mime_magic: can't read `/var/www/html/info.php'
[Tue Jul 24 18:44:21.084848 2018] [core:error] [pid 4986] (13)Permission denied: [client ::1:38162] AH00132: file permissions deny server access: /var/www/html/info.php
But the file belongs to “apache” user and group … 🙁
Edit III:
2
Answers
The solution to the problem is:
How @Lou said it was a SELinux problem.
I was reluctant to disable SELINUX completely. This is what worked for me: restorecon -R /var/www/html/