NYCPHP Meetup

NYPHP.org

[nycphp-talk] Can I set the response code if a PHP Fatal error occurs?

Daniel Convissor danielc at analysisandsolutions.com
Tue Feb 17 18:18:44 EST 2009


On Tue, Feb 17, 2009 at 10:09:25AM -0500, Daniel Horning wrote:
> 
> Something as simple as an "ErrorDocument 200 /path/to/other.notify.script"
> in htaccess or in apache conf should allow you to reach this goal

An application I work on uses JSON to communicate.  I've adjusted our 
.htaccess file to print out a JSON string.  Note: pick only ONE, 
depending on which version of Apache is in play.  Note: remove line wrap.

In Apache 1.3:

   ErrorDocument 500 "var response = {"code":500,"message":"Apache
   server error"};

In Apache >= 2.0:

   ErrorDocument 500 "var response = {\"code\":500,\"message\":\"Apache
   server error\"};"

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list