Re: [PHP] ErrorDocument 500 and PHP
On 03/01/2011 20:26, Ashley Sheridan wrote: On Mon, 2011-01-03 at 15:11 -0500, Bastien Koert wrote: On Mon, Jan 3, 2011 at 2:30 PM, David Lidstone wrote: On 03/01/2011 18:38, Nilesh Govindarajan wrote: On 01/03/2011 11:46 PM, David Lidstone wrote: Hi First up, I apologise as this must have been posted before, but the server is so slow I can't search, or even read messages often. I'm using Thunderbird - any tips on how to access news.php.net faster!? In Apache, I can set "ErrorDocument 404 /myerrorpage.php" and it works. Doing the same but with a 500 error for a PHP script, it doesn't. I just get the PHP error printed on the screen. What I've seen on the net implies to me that PHP does not fully interact with Apache when it generates an error, and therefore this approach will not work. Is this correct? I just want to redirect to a PHP page on 500 error and run a small script. Any suggestions? Many thanks, David Basically, it is not a 500 error. It's an error produced by the php itself. The file which was run by php had some error, so php outputs that error to the client. This is actually a successful request when you see from the apache's eye. That's what I feared, although my server seems to send 500 headers but my local xampp install sends 200 headers. Strange. So what do people do about getting notified about errors? - I have too many sites to look after to manually sift through logs. I can't refactor every script with try / catch (which wouldn't catch compile bugs anyway)? How does Apache know to log the error with "ErrorLog" but not redirect with "ErrorDocument"? Is there a way I can piggy-back this behaviour instead? Sorry for so many questions, but the more I look at this the crazier it seems and most of the stuff on the net is just static! Perl interacts "fully" with Apache from what I can gather. Anyone know whether this is planned for the future? When I had to use IIS and ASP it had this functionality and it was very handy. Thanks again, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Check the php.ini file to ensure that error reporting is turned on. This will allow php to show you where/what the error is. For a dev box this is acceptable but should be turned off in production -- Bastien Cat, the other other white meat If the same sorts of errors are happening over and over, then you should look into it, as it could be affecting your users on the website. Try and unit test whatever parts you can, so that you can see what happens when a user interacts with your app. Thanks, Ash http://www.ashleysheridan.co.uk Thanks for your reply Ashley Unfortunately, this isn't really what I was getting at. I'm really just looking for something which will notify us every time there is an error on any of the very many disparate scripts / 'apps' running on a given server. There is no one app although many are built on a framework which has a boot-strap file similar to ZF so a set_error_handler solution, while far from ideal, may cover some bases if there is one? There are possible solutions I can think of such as parsing all the log files perhaps, but none of these are as elegant as what is available to Apache/Perl and IIS/ASP which is suprising to me as PHP usually covers all the bases. I'm hoping I'm just ignorant of that simple solution? I'm also interested in the functionality and interaction of PHP with Apache - I know little of this, but as noted in my original post, there appears on the surface to be some discrepancy about this interaction in terms of logging vs error documents. Perhaps I should be posting some of this in .internals or one of the other groups? Many thanks, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ErrorDocument 500 and PHP
On Mon, 2011-01-03 at 15:11 -0500, Bastien Koert wrote: > On Mon, Jan 3, 2011 at 2:30 PM, David Lidstone wrote: > > On 03/01/2011 18:38, Nilesh Govindarajan wrote: > >> > >> On 01/03/2011 11:46 PM, David Lidstone wrote: > >>> > >>> Hi > >>> > >>> First up, I apologise as this must have been posted before, but the > >>> server is so slow I can't search, or even read messages often. I'm > >>> using Thunderbird - any tips on how to access news.php.net faster!? > >>> > >>> In Apache, I can set "ErrorDocument 404 /myerrorpage.php" and it > >>> works. Doing the same but with a 500 error for a PHP script, it > >>> doesn't. I just get the PHP error printed on the screen. What I've > >>> seen on the net implies to me that PHP does not fully interact with > >>> Apache when it generates an error, and therefore this approach will > >>> not work. Is this correct? > >>> > >>> I just want to redirect to a PHP page on 500 error and run a small > >>> script. Any suggestions? > >>> > >>> Many thanks, > >>> David > >>> > >> > >> Basically, it is not a 500 error. > >> It's an error produced by the php itself. > >> The file which was run by php had some error, so php outputs that error > >> to the client. This is actually a successful request when you see from > >> the apache's eye. > >> > > > > That's what I feared, although my server seems to send 500 headers but my > > local xampp install sends 200 headers. Strange. > > > > So what do people do about getting notified about errors? - I have too many > > sites to look after to manually sift through logs. I can't refactor every > > script with try / catch (which wouldn't catch compile bugs anyway)? How does > > Apache know to log the error with "ErrorLog" but not redirect with > > "ErrorDocument"? Is there a way I can piggy-back this behaviour instead? > > Sorry for so many questions, but the more I look at this the crazier it > > seems and most of the stuff on the net is just static! > > > > Perl interacts "fully" with Apache from what I can gather. Anyone know > > whether this is planned for the future? When I had to use IIS and ASP it had > > this functionality and it was very handy. > > > > Thanks again, > > David > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > Check the php.ini file to ensure that error reporting is turned on. > This will allow php to show you where/what the error is. > > For a dev box this is acceptable but should be turned off in production > -- > > Bastien > > Cat, the other other white meat > If the same sorts of errors are happening over and over, then you should look into it, as it could be affecting your users on the website. Try and unit test whatever parts you can, so that you can see what happens when a user interacts with your app. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] ErrorDocument 500 and PHP
On Mon, Jan 3, 2011 at 2:30 PM, David Lidstone wrote: > On 03/01/2011 18:38, Nilesh Govindarajan wrote: >> >> On 01/03/2011 11:46 PM, David Lidstone wrote: >>> >>> Hi >>> >>> First up, I apologise as this must have been posted before, but the >>> server is so slow I can't search, or even read messages often. I'm >>> using Thunderbird - any tips on how to access news.php.net faster!? >>> >>> In Apache, I can set "ErrorDocument 404 /myerrorpage.php" and it >>> works. Doing the same but with a 500 error for a PHP script, it >>> doesn't. I just get the PHP error printed on the screen. What I've >>> seen on the net implies to me that PHP does not fully interact with >>> Apache when it generates an error, and therefore this approach will >>> not work. Is this correct? >>> >>> I just want to redirect to a PHP page on 500 error and run a small >>> script. Any suggestions? >>> >>> Many thanks, >>> David >>> >> >> Basically, it is not a 500 error. >> It's an error produced by the php itself. >> The file which was run by php had some error, so php outputs that error >> to the client. This is actually a successful request when you see from >> the apache's eye. >> > > That's what I feared, although my server seems to send 500 headers but my > local xampp install sends 200 headers. Strange. > > So what do people do about getting notified about errors? - I have too many > sites to look after to manually sift through logs. I can't refactor every > script with try / catch (which wouldn't catch compile bugs anyway)? How does > Apache know to log the error with "ErrorLog" but not redirect with > "ErrorDocument"? Is there a way I can piggy-back this behaviour instead? > Sorry for so many questions, but the more I look at this the crazier it > seems and most of the stuff on the net is just static! > > Perl interacts "fully" with Apache from what I can gather. Anyone know > whether this is planned for the future? When I had to use IIS and ASP it had > this functionality and it was very handy. > > Thanks again, > David > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Check the php.ini file to ensure that error reporting is turned on. This will allow php to show you where/what the error is. For a dev box this is acceptable but should be turned off in production -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ErrorDocument 500 and PHP
On 03/01/2011 18:38, Nilesh Govindarajan wrote: On 01/03/2011 11:46 PM, David Lidstone wrote: Hi First up, I apologise as this must have been posted before, but the server is so slow I can't search, or even read messages often. I'm using Thunderbird - any tips on how to access news.php.net faster!? In Apache, I can set "ErrorDocument 404 /myerrorpage.php" and it works. Doing the same but with a 500 error for a PHP script, it doesn't. I just get the PHP error printed on the screen. What I've seen on the net implies to me that PHP does not fully interact with Apache when it generates an error, and therefore this approach will not work. Is this correct? I just want to redirect to a PHP page on 500 error and run a small script. Any suggestions? Many thanks, David Basically, it is not a 500 error. It's an error produced by the php itself. The file which was run by php had some error, so php outputs that error to the client. This is actually a successful request when you see from the apache's eye. That's what I feared, although my server seems to send 500 headers but my local xampp install sends 200 headers. Strange. So what do people do about getting notified about errors? - I have too many sites to look after to manually sift through logs. I can't refactor every script with try / catch (which wouldn't catch compile bugs anyway)? How does Apache know to log the error with "ErrorLog" but not redirect with "ErrorDocument"? Is there a way I can piggy-back this behaviour instead? Sorry for so many questions, but the more I look at this the crazier it seems and most of the stuff on the net is just static! Perl interacts "fully" with Apache from what I can gather. Anyone know whether this is planned for the future? When I had to use IIS and ASP it had this functionality and it was very handy. Thanks again, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ErrorDocument 500 and PHP
On 01/03/2011 11:46 PM, David Lidstone wrote: Hi First up, I apologise as this must have been posted before, but the server is so slow I can't search, or even read messages often. I'm using Thunderbird - any tips on how to access news.php.net faster!? In Apache, I can set "ErrorDocument 404 /myerrorpage.php" and it works. Doing the same but with a 500 error for a PHP script, it doesn't. I just get the PHP error printed on the screen. What I've seen on the net implies to me that PHP does not fully interact with Apache when it generates an error, and therefore this approach will not work. Is this correct? I just want to redirect to a PHP page on 500 error and run a small script. Any suggestions? Many thanks, David Basically, it is not a 500 error. It's an error produced by the php itself. The file which was run by php had some error, so php outputs that error to the client. This is actually a successful request when you see from the apache's eye. -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twitter.com/nileshgr Website: http://www.itech7.com VPS Hosting: http://www.itech7.com/a/vps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php