64 if ( !function_exists(
'mysqli_init' ) ) {
66 "MySQLi functions missing, have you compiled PHP with the --with-mysqli option?"
71 mysqli_report( MYSQLI_REPORT_OFF );
83 $hostAndPort = IPUtils::splitHostAndPort(
$server );
85 $realServer = $hostAndPort[0];
86 if ( $hostAndPort[1] ) {
87 $port = $hostAndPort[1];
89 } elseif ( substr_count(
$server,
':/' ) == 1 ) {
92 list( $realServer, $socket ) = explode(
':',
$server, 2 );
97 $mysqli = mysqli_init();
101 $flags = MYSQLI_CLIENT_FOUND_ROWS;
102 if ( $this->
getFlag( self::DBO_SSL ) ) {
103 $flags |= MYSQLI_CLIENT_SSL;
112 if ( $this->
getFlag( self::DBO_COMPRESS ) ) {
113 $flags |= MYSQLI_CLIENT_COMPRESS;
115 if ( $this->
getFlag( self::DBO_PERSISTENT ) ) {
116 $realServer =
'p:' . $realServer;
119 if ( $this->utf8Mode ) {
122 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'utf8' );
124 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'binary' );
126 $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
130 return $ok ? $mysqli :
null;