Solution for “Fatal error: Maximum function nestin

2019-01-01 00:46发布

I have made a function that finds all the URLs within an html file and repeats the same process for each html content linked to the discovered URLs. The function is recursive and can go on endlessly. However, I have put a limit on the recursion by setting a global variable which causes the recursion to stop after 100 recursions.

However, php returns this error:

Fatal error: Maximum function nesting level of '100' reached, aborting! in D:\wamp\www\crawler1\simplehtmldom_1_5\simple_html_dom.php on line 1355

ERROR

I found a solution here: Increasing nesting function calls limit but this is not working in my case.

I am quoting one of the answers from the link mentioned above. Please do consider it.

"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."

Is there a way to increase the maximum function nesting level in PHP

21条回答
人气声优
2楼-- · 2019-01-01 01:35

Another solution is to add xdebug.max_nesting_level = 200 in your php.ini

查看更多
伤终究还是伤i
3楼-- · 2019-01-01 01:36

probably happened because of xdebug.

Try commenting the following line in your "php.ini" and restart your server to reload PHP.

  ";xdebug.max_nesting_level"

查看更多
步步皆殇っ
4楼-- · 2019-01-01 01:37
<?php
ini_set('xdebug.max_nesting_level', 9999);
... your code ...

P.S. Change 9999 to any number you want.

查看更多
登录 后发表回答