doupijin0397 2018-07-24 15:38
浏览 710
已采纳

CentOS + Apache:您无权访问此服务器上的/info.php

I have installed CentOS 7 with Apache Web Server and PHP. But when I try to test php I've got this error

enter image description here

The user and group of info.php are "apache"

enter image description here

My Document Root is defined like you can see:

enter image description here

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:

enter image description here

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 ... :(

enter image description here

Edit III:

enter image description here

  • 写回答

1条回答 默认 最新

  • douwen3127 2018-07-25 18:06
    关注

    The solution to the problem is:

    sudo chcon -R -v -t httpd_sys_rw_content_t info.php
    

    How @Lou said it was a SELinux problem.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?