2003-02-12 00:46:29 +00:00
|
|
|
--TEST--
|
|
|
|
mysqli connect
|
2004-12-04 08:50:33 +00:00
|
|
|
--SKIPIF--
|
2007-10-10 10:06:53 +00:00
|
|
|
<?php
|
|
|
|
require_once('skipif.inc');
|
|
|
|
require_once('skipifemb.inc');
|
|
|
|
require_once('skipifconnectfailure.inc');
|
|
|
|
?>
|
2003-02-12 00:46:29 +00:00
|
|
|
--FILE--
|
2003-08-12 02:05:21 +00:00
|
|
|
<?php
|
2004-12-04 08:16:04 +00:00
|
|
|
include "connect.inc";
|
2003-08-12 02:05:21 +00:00
|
|
|
|
2003-02-12 00:46:29 +00:00
|
|
|
$test = "";
|
2005-01-07 14:59:59 +00:00
|
|
|
|
2003-02-12 00:46:29 +00:00
|
|
|
/*** test mysqli_connect localhost:port ***/
|
2007-10-10 10:06:53 +00:00
|
|
|
$link = mysqli_connect($host, $user, $passwd, "", $port, $socket);
|
2003-02-12 00:46:29 +00:00
|
|
|
$test .= ($link) ? "1" : "0";
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
/*** test mysqli_real_connect ***/
|
2007-10-10 10:06:53 +00:00
|
|
|
$link = mysqli_init();
|
|
|
|
$test.= (mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
|
2003-02-12 00:46:29 +00:00
|
|
|
? "1" : "0";
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
/*** test mysqli_real_connect with db ***/
|
2007-10-10 10:06:53 +00:00
|
|
|
$link = mysqli_init();
|
|
|
|
$test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
|
2003-02-12 00:46:29 +00:00
|
|
|
? "1" : "0";
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
|
|
/*** test mysqli_real_connect with port ***/
|
2007-10-10 10:06:53 +00:00
|
|
|
$link = mysqli_init();
|
|
|
|
$test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
|
2003-02-12 00:46:29 +00:00
|
|
|
? "1":"0";
|
|
|
|
mysqli_close($link);
|
|
|
|
|
2007-10-10 10:06:53 +00:00
|
|
|
/* temporary addition for Kent's setup, Win32 box */
|
|
|
|
for ($i = 0; $i < 10; $i++) {
|
|
|
|
if (!$link = mysqli_init())
|
|
|
|
printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
|
|
|
|
|
|
|
|
if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
|
|
|
|
printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
|
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
}
|
|
|
|
|
2003-02-12 00:46:29 +00:00
|
|
|
/*** test mysqli_real_connect compressed ***/
|
2007-10-10 10:06:53 +00:00
|
|
|
/*
|
|
|
|
$link = mysqli_init();
|
|
|
|
$test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
|
2003-02-12 00:46:29 +00:00
|
|
|
? "1" : "0";
|
|
|
|
mysqli_close($link);
|
2007-10-10 10:06:53 +00:00
|
|
|
*/
|
2003-02-12 00:46:29 +00:00
|
|
|
/* todo ssl connections */
|
|
|
|
|
|
|
|
var_dump($test);
|
2007-10-10 10:06:53 +00:00
|
|
|
print "done!";
|
2003-02-12 00:46:29 +00:00
|
|
|
?>
|
2007-10-10 10:06:53 +00:00
|
|
|
--EXPECTF--
|
|
|
|
%s(4) "1111"
|
|
|
|
done!
|