How to fix xdebug maximum function nesting level error during Magento 2 installation

- Fire development, Magento 2

Magento 2 export CLI

Below, we describe how to fix the xdebug maximum function nesting level error during the Magento 2 installation. You can discover more useful recommendations on how to fix other Magento 2 errors here: Magento 2 Cookbook.

'

The Issue

If the following message (or a similar one) displays during the installation of the Magento 2 software, you have to follow the guide below:

The Solution

The xdebug issue affects not only the Magento installation but may also prevent access to the storefront or Magento Admin after it. Thus, if your development practices rely upon the optional xdebug PHP extension, you can encounter various exceptions, including the ones we’ve just mentioned.

A sample exception looks as follows:

However, it is not difficult to resolve the issue. You only have to increase the maximum function nesting level. Do the following:

  • First of all, it is necessary to disable the xdebug extension.
  • After that, you can increase the value of the xdebug.max_nesting_level setting up to 200 or more. Do that either in php.ini or in a folder with configuration files for PHP extensions where the xdebug.ini file is situated. You can find the location of php.ini in wamp manager or with the help of the phpinfo() function. For more information, explore the xdebug documentation.
  • Next, it is necessary to restart Apache. On CentOS, use this command:


    On Ubuntu, enter the following one:

You can find more facts about the issue in this article: Magento 2 xdebug maximum function nesting level error.

'