<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.mysqlnd.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'mysqlnd.config.php',
    1 => 'Configurazione di Runtime',
    2 => 'Configurazione di Runtime',
  ),
  'up' => 
  array (
    0 => 'book.mysqlnd.php',
    1 => 'Mysqlnd',
  ),
  'prev' => 
  array (
    0 => 'mysqlnd.install.php',
    1 => 'Installation',
  ),
  'next' => 
  array (
    0 => 'mysqlnd.incompatibilities.php',
    1 => 'Incompatibilities',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysqlnd/config.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqlnd.config" class="chapter">

  <h1 class="title">Configurazione di Runtime</h1>

  <p class="simpara">
Il comportamento di queste funzioni è influenzato dalle impostazioni di <var class="filename">php.ini</var>.
</p>

  <p class="para">
  <table id="mysqlnd.config.options" class="doctable table">
   <caption><strong>MySQL Native Driver Configuration Options</strong></caption>
   
    <thead>
     <tr>
      <th>Nome</th>
      <th>Default</th>
      <th>Modificabile</th>
      <th>Storico dei cambiamenti</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.collect-statistics" class="link">mysqlnd.collect_statistics</a></td>
      <td>&quot;1&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.collect-memory-statistics" class="link">mysqlnd.collect_memory_statistics</a></td>
      <td>&quot;0&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.debug" class="link">mysqlnd.debug</a></td>
      <td>&quot;&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.log-mask" class="link">mysqlnd.log_mask</a></td>
      <td>0</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.mempool-default-size" class="link">mysqlnd.mempool_default_size</a></td>
      <td>16000</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.net-read-timeout" class="link">mysqlnd.net_read_timeout</a></td>
      <td>&quot;86400&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>
       Before PHP 7.2.0 the default value was &quot;31536000&quot;
       and the changeability was <strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong>
      </td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.net-cmd-buffer-size" class="link">mysqlnd.net_cmd_buffer_size</a></td>
      <td>&quot;4096&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.net-read-buffer-size" class="link">mysqlnd.net_read_buffer_size</a></td>
      <td>&quot;32768&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.sha256-server-public-key" class="link">mysqlnd.sha256_server_public_key</a></td>
      <td>&quot;&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-perdir">INI_PERDIR</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

      <tr>
       <td><a href="mysqlnd.config.php#ini.mysqlnd.trace-alloc" class="link">mysqlnd.trace_alloc</a></td>
       <td>&quot;&quot;</td>
       <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
       <td class="empty">&nbsp;</td>
      </tr>

     <tr>
      <td><a href="mysqlnd.config.php#ini.mysqlnd.fetch_data_copy" class="link">mysqlnd.fetch_data_copy</a></td>
      <td>0</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>Removed as of PHP 8.1.0</td>
     </tr>

    </tbody>
   
  </table>

  Per maggiori dettagli e definizioni sui 
modi INI_*, vedere <a href="configuration.changes.modes.php" class="xref">Where a configuration setting may be set</a>.
 </p>

  <p class="para">Breve descrizione dei parametri
di configurazione.</p>

  <dl>
  
   <dt id="ini.mysqlnd.collect-statistics">
    <code class="parameter">mysqlnd.collect_statistics</code>
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Enables the collection of various client statistics which can be
     accessed through <span class="function"><a href="function.mysqli-get-client-stats.php" class="function">mysqli_get_client_stats()</a></span>,
     <span class="function"><a href="mysqli.get-connection-stats.php" class="function">mysqli_get_connection_stats()</a></span>,
     and are shown in
     <code class="literal">mysqlnd</code> section of the output of the
     <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> function as well.
    </span>
    <span class="simpara">
     This configuration setting enables all
     <a href="mysqlnd.stats.php" class="link">MySQL Native Driver
     statistics</a> except those relating to memory management.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.collect-memory-statistics">
    <code class="parameter">mysqlnd.collect_memory_statistics</code>
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Enable the collection of various memory statistics which can be
     accessed through <span class="function"><a href="function.mysqli-get-client-stats.php" class="function">mysqli_get_client_stats()</a></span>,
     <span class="function"><a href="mysqli.get-connection-stats.php" class="function">mysqli_get_connection_stats()</a></span>,
     and are shown in
     <code class="literal">mysqlnd</code> section of the output of the
     <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> function as well.
    </span>
    <span class="simpara">
     This configuration setting enables the memory management
     statistics within the overall set of
     <a href="mysqlnd.stats.php" class="link">MySQL Native Driver
     statistics</a>.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.debug">
    <code class="parameter">mysqlnd.debug</code> <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Records communication from all extensions using
     <code class="literal">mysqlnd</code> to the specified log file.
    </span>
    <span class="simpara">
     The format of the directive is <code class="literal">mysqlnd.debug =
     &quot;option1[,parameter_option1][:option2[,parameter_option2]]&quot;</code>.
    </span>
    <span class="simpara">
     The options for the format string are as follows:
    </span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       A[,file] - Appends trace output to specified file. Also ensures
       that data is written after each write. This is done by closing
       and reopening the trace file (this is slow). It helps ensure a
       complete log file should the application crash.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       a[,file] - Appends trace output to the specified file.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       d - Enables output from DBUG_&lt;N&gt; macros for the current
       state. May be followed by a list of keywords which selects
       output only for the DBUG macros with that keyword. An empty list
       of keywords implies output for all macros.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       f[,functions] - Limits debugger actions to the specified list of
       functions. An empty list of functions implies that all functions
       are selected.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       F - Marks each debugger output line with the name of the source
       file containing the macro causing the output.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       i - Marks each debugger output line with the PID of the current
       process.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       L - Marks each debugger output line with the name of the source
       file line number of the macro causing the output.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       n - Marks each debugger output line with the current function
       nesting depth
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       o[,file] - Similar to a[,file] but overwrites old file, and does
       not append.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       O[,file] - Similar to A[,file] but overwrites old file, and does
       not append.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       t[,N] - Enables function control flow tracing. The maximum
       nesting depth is specified by N, and defaults to 200.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       x - This option activates profiling.
      </span>
     </li>
      <li class="listitem">
      <span class="simpara">
       m - Trace memory allocation and deallocation related calls.
      </span>
     </li>
    </ul>
    <span class="simpara">
     Example:
    </span>
<div class="example-contents">
<div class="cdata"><pre>
d:t:x:O,/tmp/mysqlnd.trace
</pre></div>
</div>

    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      This feature is only available with a debug build of PHP.
     </span>
    </p></blockquote>
    <span class="simpara"/>
   </dd>
  
  
   <dt id="ini.mysqlnd.log-mask">
    <code class="parameter">mysqlnd.log_mask</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Defines which queries will be logged. The default 0, which disables logging.
     Define using an integer, and not with PHP constants. For example, a value of
     48 (16 + 32) will log slow queries which either use &#039;no good index&#039;
     (SERVER_QUERY_NO_GOOD_INDEX_USED = 16) or no index at all (SERVER_QUERY_NO_INDEX_USED = 32).
     A value of 2043 (1 + 2 + 8 + ... + 1024) will log all slow query types.
    </span>
    <span class="simpara">
     The types are as follows: SERVER_STATUS_IN_TRANS=1, SERVER_STATUS_AUTOCOMMIT=2,
     SERVER_MORE_RESULTS_EXISTS=8, SERVER_QUERY_NO_GOOD_INDEX_USED=16, SERVER_QUERY_NO_INDEX_USED=32,
     SERVER_STATUS_CURSOR_EXISTS=64, SERVER_STATUS_LAST_ROW_SENT=128, SERVER_STATUS_DB_DROPPED=256,
     SERVER_STATUS_NO_BACKSLASH_ESCAPES=512, and SERVER_QUERY_WAS_SLOW=1024.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.mempool-default-size">
    <code class="parameter">mysqlnd.mempool_default_size</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Default size of the mysqlnd memory pool, which is used by result sets.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.net-read-timeout">
    <code class="parameter">mysqlnd.net_read_timeout</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     <code class="literal">mysqlnd</code> and the MySQL Client Library,
     <code class="literal">libmysqlclient</code> use different networking APIs.
     <code class="literal">mysqlnd</code> uses PHP streams, whereas
     <code class="literal">libmysqlclient</code> uses its own wrapper around the
     operating level network calls. PHP, by default, sets a read
     timeout of 60s for streams. This is set via
     <var class="filename">php.ini</var>,
     <code class="literal">default_socket_timeout</code>. This default applies to
     all streams that set no other timeout value.
     <code class="literal">mysqlnd</code> does not set any other value and
     therefore connections of long running queries can be disconnected
     after <code class="literal">default_socket_timeout</code> seconds resulting
     in an error message <q class="quote">2006 - MySQL Server has gone
     away</q>. 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. <code class="literal">mysqlnd</code> now
     uses the same very long timeout. The value is configurable through
     a new <var class="filename">php.ini</var> setting:
     <code class="literal">mysqlnd.net_read_timeout</code>.
     <code class="literal">mysqlnd.net_read_timeout</code> gets used by any
     extension (<code class="literal">ext/mysql</code>,
     <code class="literal">ext/mysqli</code>, <code class="literal">PDO_MySQL</code>) that
     uses <code class="literal">mysqlnd</code>. <code class="literal">mysqlnd</code> tells
     PHP Streams to use <code class="literal">mysqlnd.net_read_timeout</code>.
     Please note that there may be subtle differences between
     <code class="literal">MYSQL_OPT_READ_TIMEOUT</code> from the MySQL Client
     Library and PHP Streams, for example
     <code class="literal">MYSQL_OPT_READ_TIMEOUT</code> is documented to work
     only for TCP/IP connections and, prior to MySQL 5.1.2, only for
     Windows. PHP streams may not have this limitation. Please check
     the streams documentation, if in doubt.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.net-cmd-buffer-size">
    <code class="parameter">mysqlnd.net_cmd_buffer_size</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     <code class="literal">mysqlnd</code> allocates an internal command/network
     buffer of <code class="literal">mysqlnd.net_cmd_buffer_size</code> (in
     <var class="filename">php.ini</var>) bytes for every connection. If a
     MySQL Client Server protocol command, for example,
     <code class="literal">COM_QUERY</code> (<q class="quote">normal</q> query), does
     not fit into the buffer, <code class="literal">mysqlnd</code> will grow the
     buffer to the size required for sending the command. Whenever the
     buffer gets extended for one connection,
     <code class="literal">command_buffer_too_small</code> will be incremented by
     one.
    </span>
    <span class="simpara">
     If <code class="literal">mysqlnd</code> has to grow the buffer beyond its
     initial size of <code class="literal">mysqlnd.net_cmd_buffer_size</code>
     bytes for almost every connection, you should consider increasing
     the default size to avoid re-allocations.
    </span>
    <span class="simpara">
     The default buffer size is 4096 bytes, which is the smallest value possible.
    </span>
    <span class="simpara">
     The value can also be set using <code class="literal">mysqli_options(link,
     MYSQLI_OPT_NET_CMD_BUFFER_SIZE, size)</code>.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.net-read-buffer-size">
    <code class="parameter">mysqlnd.net_read_buffer_size</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Maximum read chunk size in bytes when reading the body of a MySQL
     command packet. The MySQL client server protocol encapsulates all
     its commands in packets. The packets consist of a small header and
     a body with the actual payload. The size of the body is encoded in
     the header. <code class="literal">mysqlnd</code> reads the body in chunks of
     <code class="literal">MIN(header.size, mysqlnd.net_read_buffer_size)</code>
     bytes. If a packet body is larger than
     <code class="literal">mysqlnd.net_read_buffer_size</code> bytes,
     <code class="literal">mysqlnd</code> has to call <code class="literal">read()</code>
     multiple times.
    </span>
    <span class="simpara">
     The value can also be set using <code class="literal">mysqli_options(link,
     MYSQLI_OPT_NET_READ_BUFFER_SIZE, size)</code>.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.sha256-server-public-key">
    <code class="parameter">mysqlnd.sha256_server_public_key</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <span class="simpara">
     SHA-256 Authentication Plugin related. File with the MySQL server
     public RSA key.
    </span>
    <span class="simpara">
     Clients can either omit setting a public RSA key, specify the key through
     this PHP configuration setting or set the key at runtime using
     <span class="function"><a href="mysqli.options.php" class="function">mysqli_options()</a></span>. If not public RSA key file is
     given by the client, then the key will be exchanged as part of the
     standard SHA-256 Authentication Plugin authentication procedure.
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.trace-alloc">
    <code class="parameter">mysqlnd.trace_alloc</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <span class="simpara">
    </span>
   </dd>
  
  
   <dt id="ini.mysqlnd.fetch_data_copy">
    <code class="parameter">mysqlnd.fetch_data_copy</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <span class="simpara">
     Enforce copying result sets from the internal
     result set buffers into PHP variables instead of using the default
     reference and copy-on-write logic. Please, see the
     <a href="mysqlnd.memory.php" class="link">memory management implementation notes</a>
     for further details.
    </span>
    <span class="simpara">
     Copying result sets instead of having PHP variables reference
     them allows releasing the memory occupied for the PHP variables earlier.
     Depending on the user API code, the actual database quries and the
     size of their result sets this may reduce the memory footprint
     of mysqlnd.
    </span>
    <span class="simpara">
      Do not set if using PDO_MySQL. PDO_MySQL has not yet been updated to support
      the new fetch mode.
    </span>
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <span class="simpara">Removed as of PHP 8.1.0</span>
   </p></blockquote>
   </dd>
  
 </dl>
</div>
<?php manual_footer($setup); ?>