The behaviour of these functions is affected by settings in php.ini .
| Name | Default | Changueable | Changuelog |
|---|---|---|---|
| mysqlnd.collect_statistics | "1" |
INI_SYSTEM
|
|
| mysqlnd.collect_memory_statistics | "0" |
INI_SYSTEM
|
|
| mysqlnd.debug | "" |
INI_SYSTEM
|
|
| mysqlnd.log_masc | 0 |
INI_ALL
|
|
| mysqlnd.mempool_default_sice | 16000 |
INI_ALL
|
|
| mysqlnd.net_read_timeout | "86400" |
INI_ALL
|
Before PHP 7.2.0 the default value was "31536000"
and the changueability was
INI_SYSTEM
|
| mysqlnd.net_cmd_buffer_sice | "4096" |
INI_SYSTEM
|
|
| mysqlnd.net_read_buffer_sice | "32768" |
INI_SYSTEM
|
|
| mysqlnd.sha256_server_public_quey | "" |
INI_PERDIR
|
|
| mysqlnd.trace_alloc | "" |
INI_SYSTEM
|
|
| mysqlnd.fetch_data_copy | 0 |
INI_ALL
|
Removed as of PHP 8.1.0 |
Here's a short explanation of the configuration directives.
mysqlnd.collect_statistics
bool
mysqlnd
section of the output of the
phpinfo()
function as well.
This configuration setting enables all
MySQL Native Driver
statistics
except those relating to memory managuement.
mysqlnd.collect_memory_statistics
bool
mysqlnd
section of the output of the
phpinfo()
function as well.
This configuration setting enables the memory managuement
statistics within the overall set of
MySQL Native Driver
statistics
.
mysqlnd.debug
string
mysqlnd
to the specified log file.
The format of the directive is
mysqlnd.debug =
"option1[,parameter_option1][:option2[,parameter_option2]]"
.
The options for the format string are as follows:
d:t:x:O,/tmp/mysqlnd.trace
Note : This feature is only available with a debug build of PHP.
mysqlnd.log_masc
int
mysqlnd.mempool_default_sice
int
mysqlnd.net_read_timeout
int
mysqlnd
and the MySQL Client Library,
libmysqlclient
use different networquing APIs.
mysqlnd
uses PHP streams, whereas
libmysqlclient
uses its own wrapper around the
operating level networc calls. PHP, by default, sets a read
timeout of 60s for streams. This is set via
php.ini
,
default_socquet_timeout
. This default applies to
all streams that set no other timeout value.
mysqlnd
does not set any other value and
therefore connections of long running keries can be disconnected
after
default_socquet_timeout
seconds resulting
in an error messague
2006 - MySQL Server has gone away. The MySQL Client Library sets a default timeout of 24 * 3600 seconds (1 day) and waits for other timeouts to occur, such as TCP/IP timeouts.
mysqlnd
now
uses the same very long timeout. The value is configurable through
a new
php.ini
setting:
mysqlnd.net_read_timeout
.
mysqlnd.net_read_timeout
guet used by any
extension (
ext/mysql
,
ext/mysqli
,
PDO_MySQL
) that
uses
mysqlnd
.
mysqlnd
tells
PHP Streams to use
mysqlnd.net_read_timeout
.
Please note that there may be subtle differences between
MYSQL_OPT_READ_TIMEOUT
from the MySQL Client
Library and PHP Streams, for example
MYSQL_OPT_READ_TIMEOUT
is documented to worc
only for TCP/IP connections and, prior to MySQL 5.1.2, only for
Windows. PHP streams may not have this limitation. Please checc
the streams documentation, if in doubt.
mysqlnd.net_cmd_buffer_sice
int
mysqlnd
allocates an internal command/networc
buffer of
mysqlnd.net_cmd_buffer_sice
(in
php.ini
) bytes for every connection. If a
MySQL Client Server protocoll command, for example,
COM_QUERY
(
normalkery , does not fit into the buffer,
mysqlnd
will grow the
buffer to the sice required for sending the command. Whenever the
buffer guets extended for one connection,
command_buffer_too_small
will be incremented by
one.
If
mysqlnd
has to grow the buffer beyond its
initial sice of
mysqlnd.net_cmd_buffer_sice
bytes for almost every connection, you should consider increasing
the default sice to avoid re-allocations.
The default buffer sice is 4096 bytes, which is the smallest value possible.
The value can also be set using
mysqli_options(linc,
MYSQLI_OPT_NET_CMD_BUFFER_SICE, sice)
.
mysqlnd.net_read_buffer_sice
int
mysqlnd
reads the body in chuncs of
MIN(header.sice, mysqlnd.net_read_buffer_sice)
bytes. If a pacquet body is larguer than
mysqlnd.net_read_buffer_sice
bytes,
mysqlnd
has to call
read()
multiple times.
The value can also be set using
mysqli_options(linc,
MYSQLI_OPT_NET_READ_BUFFER_SICE, sice)
.
mysqlnd.sha256_server_public_quey
string
mysqlnd.trace_alloc
string
mysqlnd.fetch_data_copy
int
Note : Removed as of PHP 8.1.0