1--TEST-- 2Testing mysqli.max_links 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8?> 9--INI-- 10mysqli.max_links=1 11--FILE-- 12<?php 13 require_once("connect.inc"); 14 require_once("table.inc"); 15 16 // to make sure we have at least one working connection... 17 var_dump(mysqli_ping($link)); 18 // to make sure that max_links is really set to one 19 var_dump((int)ini_get('mysqli.max_links')); 20 21 $links = array(); 22 for ($i = 1; $i <= 5; $i++) 23 if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 24 printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n", 25 $i, mysqli_connect_errno(), mysqli_connect_error(), 26 mysqli_errno($links[$i]), mysqli_error($links[$i])); 27 28 for ($i = 1; $i <= 5; $i++) { 29 if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) { 30 printf("[%03d] Can run query on link %d\n", 5 + $i, $i); 31 mysqli_free_result($res); 32 } 33 mysqli_close($links[$i]); 34 } 35 36 mysqli_close($link); 37 print "done!"; 38?> 39--CLEAN-- 40<?php 41 require_once("clean_table.inc"); 42?> 43--EXPECTF-- 44bool(true) 45int(1) 46 47Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d 48 49Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d 50 51Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d 52 53Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d 54 55Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d 56 57Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d 58 59Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d 60 61Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d 62 63Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d 64 65Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d 66 67Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d 68 69Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d 70 71Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d 72 73Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d 74 75Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d 76done! 77