Re: How to catch fatal errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux