我在共享主机上,有cPanel, Apache, PHP是由FastCGI运行的。PHP在哪里存储错误日志?

是否有其他方法可以在共享主机环境中找到错误日志,而不必通过整个站点结构来查找error_log文件?

我可以访问PHP .ini文件(我使用PHP 5.2.16版本)。


当前回答

在命令行中输入cat <file location> | grep ErrorLog在httpd.conf文件中查找ErrorLog。例如:

cat /etc/apache2/httpd.conf | grep ErrorLog

输出:

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
ErrorLog "/private/var/log/apache2/error_log"

找到以ErrorLog开头的行,这就是答案。

注意:对于虚拟主机,您可以编辑虚拟主机文件httpd-vhosts.conf以指定不同的日志文件位置。

其他回答

如果你使用php5-fpm默认日志,它应该在下面:

/var/log/php5-fpm.log

如果您在谷歌计算引擎中,也可以是/var/log/apache2/error.log。

你可以这样看尾巴:

tail -f /var/log/apache2/error.log

对于CentOS 8,它是var/log/httpd/error_log。

您处于共享环境中,无法找到错误日志。总是检查你的cPanel仪表板是否有错误选项。如果您无法找到错误日志,那么您可以在那里找到它。

在cPanel搜索栏中,搜索Error,它将显示Error Pages,这基本上是不同HTTP错误页面的列表,其他Error是错误日志显示的地方。

共享环境中的其他地方:

/ home / yourusername / logs / home / yourusername / public_html error_log

如何找到你的PHP错误日志在Linux:

sudo updatedb

[sudo] password for eric:

sudo locate error_log

/var/log/httpd/error_log

另一种等效的方法:

sudo find / -name "error_log" 2>/dev/null

/var/log/httpd/error_log