xdebug.max_nesting_level

2019-09-02 04:47发布

I have to run a function more than 5000 time. I have setted xdebug.max_nesting_level = 10000

but it says problem loading page on firefox.

what is the max limit for xdebug.max_nesting_level and how can I solve this problem.

Please help me, thanks in advance.

2条回答
闹够了就滚
2楼-- · 2019-09-02 05:21

max_nesting_level has nothing to do with how many functions you call, but how many nested levels of function calls you have. max_nesting_level protects things like:

function a()
{
    a();
}

a();

Without Xdebug's max_nesting_level, this will make PHP crash because it runs out of stack space.

The max limit for the setting depends on he operating system, but in general anything over 2500 seems to be too high.

In order to make sure Xdebug's max_nesting_level isn't hit during running of your script, you probably need to change how your code works (ie, don't do nesting or recursive function calls). Because I do no know your code, I of course can't say whether you might just have hit a bug in it.

cheers, Derick

查看更多
我只想做你的唯一
3楼-- · 2019-09-02 05:43

Like @Dreick said, your problem is not in the nesting. To track down your problem you have to allow errors display like below, as mentioned in this answer :

display_errors = on
display_startup_errors = on
查看更多
登录 后发表回答