PHP: Mysqlnd — Manual

Change language: EnglishBrazilian PortugueseChinese (Simplified)FrenchGermanJapaneseRussianSpanishTurkishOther

Submit a Pull Request Report a Bug

  • Введение
  • Обзор
  • Установка
  • Настройка во время выполнения
  • Несовместимости
  • Постоянное соединение
  • Статистика
  • Замечания
  • Управление памятью
  • API для плагинов к встроенному драйверу MySQL
    • Сравнение плагинов mysqlnd с MySQL Proxy
    • Получение API плагинов mysqlnd
    • Архитектура плагинов MySQL Native Driver
    • API плагинов mysqlnd
    • Начинаем разработку плагина mysqlnd

add a note

User Contributed Notes 3 notes

up

down

3

koalay at gmail dot com

13 years ago

For those who manually compiled MySQL, the default
mysqlnd settings may results in error.


Your mysql_error() function may give you this message:

---------------------------
No such file or directory (trying to connect via unix:///tmp/mysql.sock)
---------------------------

This is because your manually compiled MySQL has its own place for socket.
You need to provide PHP a reference for an appropriate mysql socket.
That means you need to edit php.ini and add a section like this:

---------------------------
[mysql]
mysql.default_socket="/your/path/to/mysql.sock"
---------------------------

up

down

2

juangiordana at gmail dot com

12 years ago

Notice that since of PHP 5.3.0 there is no need to set 'default_socket_timeout to -1'.

"The MySQL Client Library sets a default timeout of 365 * 24 * 3600 seconds (1 year) and waits for other timeouts to occur, such as TCP/IP timeouts. mysqlnd now uses the same very long timeout."

http://www.php.net/mysqlnd.config.php#mysqlnd.net_read_timeout

up

down

-10

eric dot caron at gmail dot com

13 years ago

One important part of the MySQL Native Driver, which is overlooked, is that when connecting to MySQL via a socket, the connection is subject to the "default_socket_timeout" value.

This means that if you have the default_socket_timeout set to 60 (default value), and you have a query that takes longer than 60 seconds to respond, the connection will be severed and getting the query results will fail.

The solution (as of PHP 5.3.0) is to change default_socket_timeout to -1 in php.ini, or with ini_set.

add a note

Возожности mysqlnd в PHP/5.3 · bazhenov.me