IIS 7 and Above
ZendCore+FastCGI+IIS7 : Cannot embed PHP errors in response HTML. Alw...
Last post Sep 20, 2008 11:23 AM by gbraux
Sep 17, 2008 07:13 PM|gbraux|LINK
I am running WS2008 + IIS7 + FASTCGI + ZendCore.
I have not modified the default ZendCore php.ini configuration file.
Actualy, any kind of PHP error, warning or notice gives me immediately a IIS 500 Error (Internal Server Error).
It is a good thing in production environnement.
For debuging purposes, I want temporary to be able to see PHP warnings and errors embedded on the html page.
So I have set "display_errors = On" on the ZC admin panel.
But nothing changes ... I still always got error 500 on pages
containing errors, warning, or notice.
But I found that if I go to the website I want to debug using
http://localhost/mypage.php (so direclty on a browser on the
production server), I got the PHP errors embedded in the html page.
But when using the ip of the server, or the host header, I got error
I also tried using ISAPI instead of FastCGI. The problem is still
quite the same, but in that case, only parse errors or undefined
functions gives me Error 500. Notices and Warning are well embedded.
Here is the IIS error log when getting an Internal Server Error
(testPage is a test page containing a division by Zero Warning).
Data2 PHP Warning: Division by zero in C:\inetpub\wwwroot\Catalogues
\testPage.php on line 6
ErrorCode Access is denied. (0x5)
HttpReason Internal Server Error
ErrorCode The operation completed successfully. (0x0)
My php test page is as easy as :
$data = 0/0;
I would like "PHP Warning: Division by zero in C:\inetpub\wwwroot
\Catalogues " beeing printed on the return page ... Instead of it, I
got 500 error, even with display_errors=On.
I also tried to process the test page directly on a console (using
"php -f mypage.php"), and the warning is well printed in the console.
So the problem seems not to come from the php interperter.
Zend is in a full default configuration state. The only param I have
changed is the display_errors config.
I tried also with PHP manualy installed from the official Non thread safe binaries (so without the zend package). The problem is exacly the same ...
The website is running in a unmanaged IIS appPool with Network Serivce identity.
There is maybe a right access problem somewhere (as the error log talks about an Access Denied error...). But where ? The PHP binary path ? The website path ? ... No ideas. But as the website works perfecly in production, I don't think it deals with that
The strangest thing in my problem is that errors are well printed when browsing using
http://localhost/... directly on the production server ... But got 500 error when using
http://192.168.1.1/... (the server IP).
Do anybody got an idea on how to get full PHP error reporing into the HTML page with IIS7, FastCGI and Zend Core ?
Sep 17, 2008 07:24 PM|anilr|LINK
You would need to set system.webServer/httpErrors/errorMode to Detailed to do this - default is DetailedLocalOnly so as not to expose extra information to remote clients. The following appcmd command will achieve that.
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpErrors -errorMode:Detailed
Sep 20, 2008 11:08 AM|ComradeGhorkov|LINK
I'm having the same problem too. Setting Detailed error reports doesn't help because you don't see the error messages PHP generated (just a page with details on FastCGI).
How do you get the raw output from PHP without any IIS7 fancy error pages? It's like IIS is intercepting any response with code 500 and putting its own page in its place.
I'm actually wrong a bit, when I force a divide-by-zero error it displays fine. It's an installation of Gallery2 that fails whenever I try to upload a photo.
Sep 20, 2008 11:23 AM|gbraux|LINK
The problem seemed mostly to be comming from file permissions problems ...
(Note the "access denied" error at the end of the IIS FastCgi Log)
I resolved it by :