php 如何在 Ubuntu Apache 中启用错误日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23675384/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable error log in Ubuntu Apache
提问by D555
How can I enable error log on my Ubuntu Apache Server so that if any error occurs be it any PHP Syntax and other errors, server error should get stored in error log file
如何在我的 Ubuntu Apache 服务器上启用错误日志,以便如果发生任何错误,无论是任何 PHP 语法和其他错误,服务器错误都应存储在错误日志文件中
Also how can I view apache error log file?
另外如何查看apache错误日志文件?
回答by Dushyant Joshi
By default, /var/log/apache2/error.log
.
默认情况下,/var/log/apache2/error.log
.
This can be configured in /etc/php5/apache2/php.ini
这可以配置在 /etc/php5/apache2/php.ini
You can also define a specific error log file for each VirtualHost in Apache. If you have any VirtualHost defined in /etc/apache2/sites-available/
and enabled in /etc/apache2/sites-enabled
(enable with sudo a2ensite [your-virtualhost-definition-file]
), you can change the error log by adding the following line inside your VirtualHost config:
您还可以为 Apache 中的每个 VirtualHost 定义一个特定的错误日志文件。如果您/etc/apache2/sites-available/
在/etc/apache2/sites-enabled
(启用sudo a2ensite [your-virtualhost-definition-file]
)中定义并启用了任何 VirtualHost ,您可以通过在 VirtualHost 配置中添加以下行来更改错误日志:
ErrorLog ${APACHE_LOG_DIR}/[your-vhost]-error.log
That might be useful if you have a lot of vhosts and want to split where they report the errors.
如果您有很多虚拟主机并且想要拆分它们报告错误的位置,这可能很有用。
Also, you can watch your error log live by issuing the following command (adapt to your own log file if different from the default):
此外,您可以通过发出以下命令来实时查看错误日志(如果与默认值不同,则适应您自己的日志文件):
sudo tail -f /var/log/apache2/error.log
For more information check out the following links
有关更多信息,请查看以下链接