<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'mysqlnd.config.php',
    1 => 'Налаштування під час виконання',
    2 => 'Налаштування під час виконання',
  ),
  '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">Налаштування під час виконання</h1>

  <p class="simpara">
На поведінку цих функцій випливають налаштування в <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>Назва</th>
      <th>Початково</th>
      <th>Де можна змінювати</th>
      <th>Журнал змін</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>

  Докладніша інформація та визначення режимів INI_* на сторінці <a href="configuration.changes.modes.php" class="xref">Де можна встановлювати параметри конфігурації</a>.
 </p>

  <p class="para">Тут є коротке пояснення директив
конфігурації.</p>

  <p class="para">
  <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>
     <p class="para">
      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.
     </p>
     <p class="para">
      This configuration setting enables all
      <a href="mysqlnd.stats.php" class="link">MySQL Native Driver
      statistics</a> except those relating to memory management.
     </p>
    </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>
     <p class="para">
      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.
     </p>
     <p class="para">
      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>.
     </p>
    </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>
     <p class="para">
      Records communication from all extensions using
      <code class="literal">mysqlnd</code> to the specified log file.
     </p>
     <p class="para">
      The format of the directive is <code class="literal">mysqlnd.debug =
      &quot;option1[,parameter_option1][:option2[,parameter_option2]]&quot;</code>.
     </p>
     <p class="para">
      The options for the format string are as follows:
     </p>
     <ul class="itemizedlist">
      <li class="listitem">
       <p class="para">
        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.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        a[,file] - Appends trace output to the specified file.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        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.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        f[,functions] - Limits debugger actions to the specified list of
        functions. An empty list of functions implies that all functions
        are selected.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        F - Marks each debugger output line with the name of the source
        file containing the macro causing the output.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        i - Marks each debugger output line with the PID of the current
        process.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        L - Marks each debugger output line with the name of the source
        file line number of the macro causing the output.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        n - Marks each debugger output line with the current function
        nesting depth
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        o[,file] - Similar to a[,file] but overwrites old file, and does
        not append.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        O[,file] - Similar to A[,file] but overwrites old file, and does
        not append.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        t[,N] - Enables function control flow tracing. The maximum
        nesting depth is specified by N, and defaults to 200.
       </p>
      </li>
      <li class="listitem">
       <p class="para">
        x - This option activates profiling.
       </p>
      </li>
       <li class="listitem">
       <p class="para">
        m - Trace memory allocation and deallocation related calls.
       </p>
      </li>
     </ul>
     <p class="para">
      Example:
     </p>
<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">Зауваження</strong>: 
      <p class="para">
       This feature is only available with a debug build of PHP.
      </p>
     </p></blockquote>
     <p class="para"/>
    </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>
     <p class="para">
      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.
     </p>
     <p class="para">
      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.
     </p>
    </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>
     <p class="para">
      Default size of the mysqlnd memory pool, which is used by result sets.
     </p>
    </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>
     <p class="para">
      <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.
     </p>
    </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>
     <p class="para">
      <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.
     </p>
     <p class="para">
      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.
     </p>
     <p class="para">
      The default buffer size is 4096 bytes, which is the smallest value possible.
     </p>
     <p class="para">
      The value can also be set using <code class="literal">mysqli_options(link,
      MYSQLI_OPT_NET_CMD_BUFFER_SIZE, size)</code>.
     </p>
    </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>
     <p class="para">
      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.
     </p>
     <p class="para">
      The value can also be set using <code class="literal">mysqli_options(link,
      MYSQLI_OPT_NET_READ_BUFFER_SIZE, size)</code>.
     </p>
    </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>
     <p class="para">
      SHA-256 Authentication Plugin related. File with the MySQL server
      public RSA key.
     </p>
     <p class="para">
      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.
     </p>
    </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>
     <p class="para">
     </p>
    </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>
     <p class="para">
      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.
     </p>
     <p class="para">
      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.
     </p>
     <p class="para">
       Do not set if using PDO_MySQL. PDO_MySQL has not yet been updated to support
       the new fetch mode.
     </p>
    <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
     <span class="simpara">Removed as of PHP 8.1.0</span>
    </p></blockquote>
    </dd>
   
  </dl>
 </p>
</div>
<?php manual_footer($setup); ?>