无差错记录深藏不露的Apache服务器500 [英] Apache 500 server error- logs showing nothing
问题描述
刚过一些帮助PHP新安装。
Just after some help with a new installation of PHP.
我设置一个新的Centos 6.2服务器与Apache PHP和时遇到麻烦的错误显示。
我复制了一个不同的所有网站应用程序文件以及在/ etc文件夹结构和家居/ httpd的/.
I've setup a new Centos 6.2 server with apache PHP and am having trouble getting errors to show. I've copied all the website application files from a different as well as the folder structure and everything in /etc/httpd/.
当我访问我的网站,我得到一个500错误或空白页。该日志显示什么都没有,除了形式记录500错误:
When I access my site, I get a 500 error, or a blank page. The logs are showing nothing at all, apart form logging the 500 error:
[24/Feb/2012:17:33:25 +1100] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20100101 Firefox/6.0.1" 405 229 7176
我的htaccess的是这样的:
ErrorDocument的404 /error.php
My htaccess looks like this: ErrorDocument 404 /error.php
php_flag display_errors on
php_flag display_startup_errors on
php_flag file_uploads on
php_value error_reporting 6143
php_value max_input_time 60
php_value post_max_size 8M
php_value upload_max_filesize 2M
~
所以错误打开...
So errors are turned on...
Start of PHP file has:
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
和php.ini中已经把error_reporting设置为E_ALL。
and php.ini has error_reporting set to E_ALL.
...但我的屏幕有些东西(如不关闭字符串)上收到错误,但我的问题是有点大,比我想,我不知道从哪里开始调试!
... yet I am getting errors on the screen for some things (such as not closing a string), but my issues are a bit bigger than i think and i have no idea where to start debugging!
所以我想我的问题是 - 我怎么开始调试500服务器错误?
So i guess my question is- how do I start debugging a 500 server error?
推荐答案
在错误消息令人恼火从屏幕从Apache的error_log文件和其他地方丢失的,我有好运气让他们通过添加不同的出现PHP文件,用它仅用于开发:
When error messages are maddeningly missing from the screen and from the Apache error_log files and anywhere else, I've had good luck getting them to appear by adding a different PHP file, using it only for development:
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
include("productioncode.php");
?>
这样一来,即使生产code.php具有编译时错误上述code运行,并得到消息显示,仅仅不同将第一两条线生产code顶部.PHP。
This way, even if productioncode.php has compile-time errors the above code runs, and the messages get displayed, unlike merely putting the first two lines at the top of productioncode.php.
@雅$ P $宠查哈尔和@Saiyam特尔 - 我刚刚从错误500的在访问日志一个可爱的傍晚,例如恢复
@Jaspreet Chahal and @Saiyam Patel - I just recovered from a lovely evening of error 500's in the access_log, e.g.
77.22.98.222 - - [26/Feb/2012:22:38:41 -0500] "GET /buggycode.php HTTP/1.1" 500 - west-real-estate.com "-" "Mozilla/5.0 (Windows NT 5.0; rv:11.0) Gecko/20100101 Firefox/11.0" "PHPSESSID=hcd04vv9e1a316cr9miauf3bl5" - 0
和来自(愚蠢)编码{'富'=>'酒吧'}代替阵列('富'=>'巴')中的任何的httpd日志文件中没有PHP错误消息。采用上述技术揭示了详细的错误信息,包括所有重要的行号。
and no PHP error messages in any httpd log file from (foolishly) coding { 'foo' => 'bar' } instead of array( 'foo' => 'bar' ). Using the above technique revealed the detailed error message, including the all-important line number.
这篇关于无差错记录深藏不露的Apache服务器500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!