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

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

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


当前回答

你可以在下面看到一个帐户的php错误:

/home/username/logs/domain_tld.php.error.log

可以在全局和本地设置php错误日志。

Globally through WHM: WHM -->> MultiPHP INI Editor --> "Editor Mode" Select the version of PHP you would like to set the error log Edit the parameter error_log. error_log = "/some/path" Change the filename to the desired error log file Save changes Locally though cPanel: CPanel -->> MultiPHP INI Editor --> "Editor Mode" Select the version of PHP you would like to set the error log Edit the parameter error_log. error_log = "/some/path" Change the filename to the desired error log file Home directory will set the option for all domains, addons, and subdomains configured on the account A specific domain will limit the change to that domain, or, in the case of an addon domain, the addon and the matching subdomain Save changes If PHP-fpm is enabled: WHM --> MultiPHP Manager Find the domain you'd like to change the error log location for Click "Edit PHP-FPM" Change the log location in "The error log file (error_log)" relative to the folder "logs" within the user's home directory Save changes

其他回答

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

/var/log/php5-fpm.log

你可以在文件管理器中查看日志文件夹。 检查public_html文件夹中的日志文件。 检查“php phpinfo()”文件以了解日志存储的位置。

就像这样:

sudo locate error.log | xargs -IX grep -iH "errorlog" X

or

sudo locate error_log | xargs -IX grep -iH "errorlog" X

or

sudo find / -iname "error?log" 2>/dev/null | xargs -IX grep -iH "errorlog" X

如果您从源代码构建Apache和PHP,那么错误日志默认生成在${Apache安装目录}/logs/error_log,即通常为/usr/local/apache2/logs/error_log。

否则,如果您已经从存储库中安装了它,则会在/var/log/apache2/error_log中找到它。

你也可以在php.ini中设置路径,并通过调用phpinfo()来验证它。

cPanel错误日志位于:

/ usr / local / cpanel / logs / / usr / local / apache / logs /

默认情况下,Apache日志位于:

/var/log/apache

or

/var/log/apache2

如果有人正在使用自定义日志位置,那么你可以通过运行这个命令来检查它:

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

如果你得到一个apache2目录不存在的错误,你可以运行这个命令来找到正确的位置:

whereis apache

or

whereis apache2