PHP警告导致脚本在运行FastCGI的IIS上暂停
We are migrating to a new server running Windows 2003 and IIS 6. When my PHP code runs, it has a warning on a particular line (which I'm expecting at the moment but will fix shortly). However, when it hits the warning, it immediately halts processing and returns a 500 error in the HTTP header. Normally, I would expect PHP to output the warning, but continue processing the script.
Is there something in the configuration for IIS, FastCGI, or PHP that would be returning 500 errors when PHP hits a warning?
To clarify: I don't want to suppress the warnings; I want them to display. I do not want the script to stop processing on warnings.
我们正在迁移到运行Windows 2003和IIS 6的新服务器。当我的PHP代码运行时,它有一个警告 在一个特定的行(我现在期待但很快就会修复)。 但是,当它遇到警告时,会立即停止处理并在HTTP标头中返回500错误。 通常情况下,我希望PHP输出警告,但继续处理脚本。 p>
IIS,FastCGI或PHP的配置中是否有什么东西会在PHP命中时返回500个错误 警告? p>
澄清: strong>我不想压制警告; 我希望他们展示。 我不希望脚本停止处理警告。 p> div>
Figured out the issue. log_errors
in php.ini was set to On
, but error_log
was unset. This was causing PHP to stop everything. After setting display_errors
to on
, the warnings now display so I can see where things are breaking in the output.
This thread was helpful: http://forums.iis.net/p/1146102/1856222.aspx#1856222
I don't know about IIS or FastCGI, but afaik php has no such option. You can however set error_reporting
(in your php.ini
) to
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
to make warnings go away.
That depends very much on your PHP code as well, if you are doing something complicated within the code and an error occurs, web servers sometimes throw 500 errors. I would suggest you:
-
Put an
@
on the line to suppress the error, i.e :$x=@my_function($y);
See your web server logs for the exact error message you get, then post it here and perhaps we could offer you a better solution.