16

Fatal error: Maximum function nesting level of '100' reached, aborting! in ...\project\db.php on line 2

My db.php code

$db = mysql_connect ("localhost","db_user","password");
mysql_select_db("db_name",$db);

What's wrong?

oboshto
  • 3,478
  • 4
  • 25
  • 24
  • 1
    this error seems to be caused by x-debug, there is an answer for this in here http://stackoverflow.com/questions/4293775/increasing-nesting-functions-calls-limit – DevZer0 Jul 05 '13 at 12:07

3 Answers3

39

Increase the value of xdebug.max_nesting_level in your php.ini, INFO
There is a question here

Community
  • 1
  • 1
mirkobrankovic
  • 2,389
  • 1
  • 21
  • 24
  • 6
    thanks, this worked fine for me. I just used it at the script level for more security like: ini_set('xdebug.max_nesting_level', 200); – Daniel Fanica Jan 21 '14 at 11:20
  • This is not a valid solution, You need to check the code whether the code is wasting request with the db or with other resources. Your code is somehow misusing the resources. – Tausif Anwar Aug 25 '17 at 12:53
  • I changed mine to 4096, still get that error.. Clearly it must be a bug in the code? – rebellion Nov 23 '18 at 12:41
11

Go into your php.ini configuration file and change the following line:

xdebug.max_nesting_level=100

to something like:

xdebug.max_nesting_level=200
Wayne Whitty
  • 19,513
  • 7
  • 44
  • 66
  • Fatal error: Maximum function nesting level of '200' reached, aborting! in Z:\home\localhost\www\clientcms\db.php on line 2 – oboshto Jul 05 '13 at 12:20
  • 2
    I'm also getting Fatal error: Maximum function nesting level of '2000' reached, aborting! I set `xdebug.max_nesting_level=2000` – phagento Jan 17 '14 at 04:14
1

mysql_connect will return a boolean therefor :

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db("databaseName");
?>
DarkBee
  • 16,592
  • 6
  • 46
  • 58