[PHP] How to catch fatal errors

2009-03-16 Thread Tanoor Dieng
Hello every body,
I'm currently working on a very high traffic web sites.
I often get a fatal error in production about memory Allowed memory size
of  ... exhausted.

Unfortunately, I can not reproduce this fatal error in developpement
environment.
The main reason for that  is that I don't know the php script which causes
the error.
Php only tell me on which file, the error has appeared, but I don't know the
orginal php script which were called.

I've tried some hacks, like the register_shutdown_function one.

This hack allows me to catch almost all fatal errors, except one which says
Allowed memory site of ...

Any idea about how to catch this error?

My main issue is to know script that has been called.


Best regards


Re: [PHP] How to catch fatal errors

2009-03-16 Thread Jochem Maas
Tanoor Dieng schreef:
 Hello every body,
 I'm currently working on a very high traffic web sites.
 I often get a fatal error in production about memory Allowed memory size
 of  ... exhausted.
 
 Unfortunately, I can not reproduce this fatal error in developpement
 environment.
 The main reason for that  is that I don't know the php script which causes
 the error.
 Php only tell me on which file, the error has appeared, but I don't know the
 orginal php script which were called.
 
 I've tried some hacks, like the register_shutdown_function one.
 
 This hack allows me to catch almost all fatal errors, except one which says
 Allowed memory site of ...
 
 Any idea about how to catch this error?

you can't - the script dies due to not enough memory, there is nothing
the script/engine can do at that point (any action would require some more 
memory).

 
 My main issue is to know script that has been called.
 

reproduce it in development, this probably means you will have to:

1. setup webserver/php conf/ini indentically to production
2. setup the dev env with a copy of live data

most likely your issue revolves around too large a dataset being read in
during some requests in the production env (e.g. a way too large product list)

in the interim increase the php memory_limit on the production server
to mitigate the problem (know that this only works if your server has the
memory available ... too many webserver processes running the php engine
with too much memory allocated will eventually cause physical memory to
run out with the consequence that the OS will start to swap memory to disk,
which will quickly bring your server grinding to a halt)

 
 Best regards
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to catch fatal errors

2009-03-16 Thread 9el
On Mon, Mar 16, 2009 at 3:51 PM, Tanoor Dieng newstan...@gmail.com wrote:

 Hello every body,
 I'm currently working on a very high traffic web sites.
 I often get a fatal error in production about memory Allowed memory size
 of  ... exhausted.

 Unfortunately, I can not reproduce this fatal error in developpement
 environment.


 Understandable why you cant reproduce the error. It gets generated when
lots of queries has been done. Working on single environment is difficult to
generate that.




 The main reason for that  is that I don't know the php script which causes
 the error.


You can do loadtesting or unit testing on the php scripts.


 Php only tell me on which file, the error has appeared, but I don't know
 the
 orginal php script which were called.

 I've tried some hacks, like the register_shutdown_function one.

 This hack allows me to catch almost all fatal errors, except one which says
 Allowed memory site of ...

 Any idea about how to catch this error?


Would be a better idea to consult an experienced Web Application Architect
who would sense the weaknesses of the codes and would suggest the reworks to
make them optimized. Would be a hectic job for inexperienced developers.


Lenin

www.twitter.com/nine_L
www.lenin9l.wordpress.com