Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost". If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as in your PHP configuration and leave the server field blank.
У библиотеки mysqli-php формулировка немного иная:
Can be either a host name or an IP address. Passing the NULL value or the string "localhost" to this parameter, the local host is assumed. When possible, pipes will be used instead of the TCP/IP protocol.
Prepending host by p: opens a persistent connection. mysqli_change_user() is automatically called on connections opened from the connection pool.
То есть, тут "предпочтительно", а как влиять на эту предпочтительность также непонятно :)
Источники:
http://php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/mysqli.connect.php
No comments :
Post a Comment
Note: only a member of this blog may post a comment.