【发布时间】:2018-01-14 07:34:55
【问题描述】:
我有一个centos7,我已经安装了httpd和mysqld。
我想通过以下方式访问 apache 登录 /var/httpd/log:
echo file_get_contents("/var/log/httpd/domains/example.com.log");
但它不起作用。
【问题讨论】:
-
如何运行这个脚本?使用网络浏览器?那么您将无法访问此文件。
-
它作为 php 文件在网络服务器上运行。
-
你不能直接这样做,网络服务器经常在
www-data下运行,它没有这样做的权限,more about this。 -
在其他服务器上我有 centos 和 directadmin 并且在 directadmin 中,我可以访问日志。
-
你拼错了“.log”。