[php] Increasing nesting function calls limit

There is one very bad limit in PHP: if you call some function a1() that calls a2(), that calls a3... so when a99() will call a100() you will see

Fatal error: Maximum function nesting level of '100' reached, aborting!

Is there any way to increase the limit of 100 nesting calls to 500 or 10000?

This is critical for me because I'm developing an event-based system with a lot of callbacks.

This question is related to php xdebug

The answer is


Personally I would suggest this is an error as opposed to a setting that needs adjusting. In my code it was because I had a class that had the same name as a library within one of my controllers and it seemed to trip it up.

Output errors and see where this is being triggered.


Do you have Zend, IonCube, or xDebug installed? If so, that is probably where you are getting this error from.

I ran into this a few years ago, and it ended up being Zend putting that limit there, not PHP. Of course removing it will let you go past the 100 iterations, but you will eventually hit the memory limits.