Archive

Archive for June, 2009

php exception handling on iis 7

June 10th, 2009

I was recently deploying a PHP site to a client hosting their content with IIS 7. In my code, I typically raise and handle exceptions. My philosophy is simply that exceptions are logical operators like “if”, “then” and “while”. At any rate, when I deployed this code to the production environment, IIS would raise an HTTP 500 exception. This is not ideal.

After hours of desperate searching, I finally found the solution to appropriate exception handling with php on IIS on the iis blog. The solution was more of a footnote about halfway down the page in the php.ini section. The trick is to set fastcgi logging to false. Not the most ideal solution, but I was finally able to handle exceptions the way php code should.

From iis blog: “FastCGI logging should be disabled on IIS. If it is left enabled, then any messages of any class are treated by FastCGI as error conditions which will cause IIS to generate an HTTP 500 exception.”

php.ini

fastcgi.logging = 0 ;

Stuff I'm Working On, web ,