mysql_connect()and mysqli_connect()use two different default ports from php.ini file. I would not have guessed that they would differ from the default default 3306, but it is worth checking or trying to add the path to the host URL.
mysqli_connect :
mysqli mysqli_connect (... int $port = ini_get ( " mysqli.default_port" )...)
mysql_connect:
PHP mysql.default_host undefined ( ), "localhost: 3306". SQL "localhost: 3306".
: , .
, , , , . mysqli_connect_errno(). PHP.net.
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
:
OO: . , mysqli_connect_error() mysqli- > connect_error .
a >