NYCPHP Meetup

NYPHP.org

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

Brian Dailey brian at realm3.com
Tue Feb 17 10:30:52 EST 2009


Also check out set_error_handler. There are even some notes on the page 
on handling fatal errors.

http://us2.php.net/manual/en/function.set-error-handler.php#88401

The apache method is probably better, if you have the ability to change 
conf files.

-b.

Daniel Horning wrote:
> Wouldn’t you just need to do this at the apache level?
> 
>  
> 
> 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
> 
>  
> 
> --
> 
> *Dan Horning*
> 
>  
> 
> *American Digital Services* - /Where you are only limited by imagination/.
> 
> _dan.horning at planetnoc.com_ :: _http://www.americandigitalservices.com_
> 
> 1-518-444-0213 x502 . /toll free/ 1-800-863-3854 . /fax/ 1-888-474-6133
> 
> /15 Third Street, PO Box 746, Troy, NY 12180 (by appointment only)/
> 
>  
> 
> *From:* talk-bounces at lists.nyphp.org 
> [mailto:talk-bounces at lists.nyphp.org] *On Behalf Of *lorband at optonline.net
> *Sent:* Tuesday, February 17, 2009 10:06 AM
> *To:* talk at lists.nyphp.org
> *Subject:* [nycphp-talk] Can I set the response code if a PHP Fatal error 
> occurs?
> 
>  
> 
>  I am using AJAX to submit a PHP request. If a PHP Fatal error occurs 
> when running the php program, the http response code is 200 and it 
> appears the program ran successfully. Is there a way for php to return a 
> 500 http response code when a fatal error occurs so myjava_script that 
> is processing the response can alert the user that an error has 
> occurred? Try/catch won't capture fatal errors for me to set the header.
> 
> Thank you,
> 
> Lori
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/show_participation.php

-- 
realm3 web applications [realm3.com]
Information architecture, application development.
phone: (917) 512-3594
fax: (440) 744-3559



More information about the talk mailing list