Solution for “Fatal error: Maximum function nesting level of '100' reached, aborting!” in PHP

后端 未结 22 2457
我寻月下人不归
我寻月下人不归 2020-11-22 16:45

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 recursiv

22条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 16:53

    Try looking in /etc/php5/conf.d/ to see if there is a file called xdebug.ini

    max_nesting_level is 100 by default

    If it is not set in that file add:

    xdebug.max_nesting_level=300
    

    to the end of the list so it looks like this

    xdebug.remote_enable=on
    xdebug.remote_handler=dbgp
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    xdebug.profiler_enable=0
    xdebug.profiler_enable_trigger=1
    xdebug.profiler_output_dir=/home/drupalpro/websites/logs/profiler
    xdebug.max_nesting_level=300
    

    you can then use @Andrey's test before and after making this change to see if worked.

    php -r 'function foo() { static $x = 1; echo "foo ", $x++, "\n"; foo(); } foo();'
    

提交回复
热议问题