PHP 在哪里存储错误日志?(PHP 5、Apache、FastCGI 和 cPanel) [英] Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel)
问题描述
我在共享主机上并且有 cPanel、Apache 和 PHP 由 FastCGI.PHP 将错误日志存储在哪里?
I am on shared hosting and have cPanel, Apache, and PHP is run by FastCGI. Where does PHP store the error log?
是否有另一种方法可以在共享托管环境中找到错误日志,而不必遍历整个站点结构来查找 error_log 文件?
Is there another way I can find the error log on a shared hosting environment instead of having to go through entire site structure to look for error_log files?
我可以访问 php.ini 文件(我使用的是 PHP 5.2.16 版).
I have access to the php.ini file (I am using PHP version 5.2.16).
推荐答案
如果 PHP 是 apache2 模块,PHP 会将错误日志存储在 /var/log/apache2
中.共享主机通常将日志文件存储在您的根目录 /log
子文件夹中.但是...如果您可以访问 php.ini
文件,您可以这样做:
PHP stores error logs in /var/log/apache2
if PHP is an apache2 module.
Shared hosts are often storing log files in your root directory /log
subfolder.
But...if you have access to a php.ini
file you can do this:
error_log = /var/log/php-scripts.log
根据 rinogo 的评论:如果您使用的是 cPanel,则您可能要查找的主日志文件(默认情况下)存储在>
According to rinogo's comment: If you're using cPanel, the master log file you're probably looking for is stored (by default) at
/usr/local/apache/logs/error_log
如果所有其他方法都失败了,您可以使用
If all else fails you can check the location of the log file using
<?php phpinfo(); ?>
这篇关于PHP 在哪里存储错误日志?(PHP 5、Apache、FastCGI 和 cPanel)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!