php 达到最大函数嵌套级别“100”,升级到 Laravel 5.1 后中止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30803342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum function nesting level of '100' reached, aborting after upgrading to Laravel 5.1
提问by Emeka Mbah
I'm getting this error message in my Laravel application after I upgraded to Laravel 5.1.
升级到 Laravel 5.1 后,我在 Laravel 应用程序中收到此错误消息。
FatalErrorException in Dispatcher.php line 200:
Maximum function nesting level of '100' reached, aborting!
This issue occurs on some URLs of my app. I have done dozens of composer update
but issue still persist. Any suggestion at all will be appreciated
此问题出现在我的应用程序的某些 URL 上。我做了几十个,composer update
但问题仍然存在。任何建议都将不胜感激
回答by Emeka Mbah
Issue is caused by default xdebug.max_nesting_level
which is 100.
问题是由默认值xdebug.max_nesting_level
100引起的。
The workaround for now is to increase xdebug.max_nesting_level
to a certain level say 200 or 300 or 400
现在的解决方法是增加到xdebug.max_nesting_level
某个级别,比如 200 或 300 或 400
I fixed mine by increasing xdebug.max_nesting_level to 120, by adding the line below to bootstrap/autoload.php
in Laravel 5.1
我通过将 xdebug.max_nesting_level 增加到 120 来修复我的问题,方法是bootstrap/autoload.php
在 Laravel 5.1 中添加以下行
ini_set('xdebug.max_nesting_level', 120);
ini_set('xdebug.max_nesting_level', 120);
.........
…………
define('LARAVEL_START', microtime(true));
define('LARAVEL_START', microtime(true));
回答by Abrar Jahin
The problem is created because of 1 PHP extension in Apache- php_xdebug
该问题是由于 Apache- php_xdebug 中的 1 个 PHP 扩展而产生的
So, the solution is-
所以,解决办法是——
- Disable the extension
- Increase the nesting level of the extension
- Increasing
max_nesting_level
in laravel
- 禁用扩展
- 增加扩展的嵌套级别
max_nesting_level
在 Laravel 中增加
In detail
详细
Option 1-
选项1-
To disable it, you can follow this.
要禁用它,您可以按照此操作。
If you are using WAMP Server, then you can easily do it by going to php.ini-
如果您使用的是WAMP Server,那么您可以通过转到php.ini轻松完成-
And then commit this-
然后提交这个——
zend_extension = "c:/WAMP/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
- Path should be different from PC to PC
- Adding an # before the line is a comment
- 路径应该不同从 PC 到 PC
- 在该行前添加 # 是注释
Option 2-
选项 2-
You can increase the limit by thisway.
您可以通过这种方式增加限制。
If you are using WAMP Server, then you can easily do it by going to php.ini-
如果您使用的是WAMP Server,那么您可以通过转到php.ini轻松完成-
And after zend_extension = "c:/WAMP/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
, there should be something like this-
之后zend_extension = "c:/WAMP/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll"
,应该是这样的——
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/WAMP/tmp"
xdebug.show_local_vars=0
Then, just add 1 line there-
然后,只需在那里添加 1 行-
xdebug.max_nesting_level=500
Option 3-
选项 3-
You can also set this configuration in Laravel autoload.phpfile.
你也可以在 Laravel autoload.php文件中设置这个配置。
You can simply add this line in the file (anywhere in the file)-
您可以简单地在文件中添加这一行(文件中的任何位置)-
ini_set('xdebug.max_nesting_level', 500);
And you will be done :)
你会完成:)
回答by Naveed Asim
This issue is due to xdebug extension is enabled, to fix this either you have to disable xdebug extension or edit php.ini file and change xdebug.max_nesting_levelto 200 ( as by default this parameter is not included in php.ini and have to add it )
此问题是由于启用了 xdebug 扩展,要解决此问题,您必须禁用 xdebug 扩展或编辑 php.ini 文件并将xdebug.max_nesting_level更改为 200(默认情况下,此参数不包含在 php.ini 中,必须添加它 )
like :
喜欢 :
xdebug.max_nesting_level=200
xdebug.max_nesting_level=200