我刚刚在Windows Server 2003上安装了Zend Server Community Edition,但是显示很多PHP页面却有点问题。 该代码先前在IIS上运行在相同版本的PHP(5.3)上,没有任何问题。
从外观上来看,Apache(作为Zend Server的一部分安装的)在页面呈现过程中出现错误,当它遇到PHP中不喜欢的东西时。 通过代码,我已经能够通过从函数调用中删除错误抑制运算符(@)并通过更改某些包含的格式来解决某些问题。 但是,我无法为整个网站做到这一点!
奇怪的是,错误代码被报告为“200 OK”。 下面的代码片段显示了Apache错误HTML如何中断页面的常规HTML。
<p>Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues.</<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>200 OK</title> </head><body> <h1>OK</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p> <p>More information about this error may be available in the server error log
Apache的错误日志不提供任何解释,我已经耗尽了我的谷歌search技能,所以任何帮助将不胜感激。 谢谢。
你会想看看你的代码。
我直接的想法是,你通过HTTP(你启用了allow_url_fopen )来包含(或者类似的function)页面或者脚本,并且包含的页面/脚本运行的服务器有问题。
如果您编辑php.ini(并重新启动Apache),将allow_url_fopen更改为false ,则您的托pipe环境中的安全性将会提高,并且很可能会出现更好的错误,告诉您尝试包含损坏的URL的位置。
@错误抑制运算符是昂贵的 – 更好的select是使用error_reporting(0)来禁用错误,或使用自己的函数。
在这种情况下,看到你根本没有任何信息,你可以尝试使用这个error handling程序代替你的默认处理程序,看看你是否可以把这个错误绑定到一个PHP函数崩溃的Apache。
function Andy_errorHandler( $errno, $errstr, $errfile, $errline ) { $stack_trace = ''; switch ( $errno ) { case E_NOTICE: case E_USER_NOTICE: case E_STRICT: return; break; default: try { throw new Exception( $errstr, $errno ); } catch( Exception $e ) { //build stack trace $stack_trace .= "File: <b>$errfile</b> Line: <b>$errline\n" . $e->getMessage() . "</b>\n" . "Error No: ".$e->getCode(). "\n"; $stack_trace .= $e->getTraceAsString(); } break; } if( ! isset( $GLOBALS['error_handler_output'] ) ) { $GLOBALS['error_handler_output'] = nl2br( $stack_trace ) . '<p/>'; } else { $GLOBALS['error_handler_output'] .= nl2br( $stack_trace ) . '<p/>'; } return true; } $old_error_handler = set_error_handler( "Andy_errorHandler" );