????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.107 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/mysql/tests/ |
Upload File : |
--TEST--
mysql_[p]connect() - max_links/max_persistent
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--INI--
mysql.max_links=2
--FILE--
<?php
require_once('connect.inc');
function my_connect($offset, $host, $user, $passwd, $db, $port, $socket) {
if ($socket)
$host = sprintf("%s:%s", $host, $socket);
else if ($port)
$host = sprintf("%s:%s", $host, $port);
$link = mysql_connect($host, $user, $passwd, true);
if (!$link) {
printf("[%03d] Cannot connect using host '%s', user '%s', password '****', [%d] %s\n",
$offset, $host, $user, $passwd,
mysql_errno(), mysql_error());
return false;
}
return $link;
}
$links = array();
// try to open 3 links
$links[0] = my_connect(10, $host, $user, $passwd, $db, $port, $socket);
$links[1] = my_connect(20, $host, $user, $passwd, $db, $port, $socket);
$links[2] = my_connect(30, $host, $user, $passwd, $db, $port, $socket);
if (false !== $links[2])
printf("[040] Last connection should not have been allowed!\n");
// free some links but let index 1 remain
unset($links[2]);
mysql_close($links[0]);
unset($links[0]);
// should be allowed -> second open connection
$links[0] = my_connect(50, $host, $user, $passwd, $db, $port, $socket);
$links[2] = my_connect(60, $host, $user, $passwd, $db, $port, $socket);
ksort($links);
var_dump($links);
mysql_close($links[0]);
mysql_close($links[1]);
print "done!\n";
?>
--EXPECTF--
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Warning: mysql_connect(): Too many open links (2) in %s on line %s
[030] Cannot connect using host '%s', user '%s', password '****', [0] 0
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
Warning: mysql_connect(): Too many open links (2) in %s on line %s
[060] Cannot connect using host '%s', user '%s', password '****', [0] 0
array(3) {
[0]=>
resource(%d) of type (mysql link)
[1]=>
resource(%d) of type (mysql link)
[2]=>
bool(false)
}
done!