<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mysqli.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'mysqli.configuration.php',
    1 => '运行时配置',
    2 => '运行时配置',
  ),
  'up' => 
  array (
    0 => 'mysqli.setup.php',
    1 => '安装/配置',
  ),
  'prev' => 
  array (
    0 => 'mysqli.installation.php',
    1 => '安装',
  ),
  'next' => 
  array (
    0 => 'mysqli.persistconns.php',
    1 => 'mysqli 扩展和持久化连接',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mysqli/ini.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli.configuration" class="section">
 <h2 class="title">运行时配置</h2>
 <p class="simpara">
这些函数的行为受 <var class="filename">php.ini</var> 中的设置影响。
</p>
 <p class="para">
  <table id="mysqli.configuration.options" class="doctable table">
   <caption><strong>MySQLi配置选项</strong></caption>
   
    <thead>
     <tr>
      <th>名字</th>
      <th>默认</th>
      <th>可修改范围</th>
      <th>更新日志</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="mysqli.configuration.php#ini.mysqli.allow-local-infile" class="link">mysqli.allow_local_infile</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>在 PHP 7.2.16 和 7.3.3 之前，默认值为 &quot;1&quot;</td>
     </tr>

     <tr>
      <td><a href="mysqli.configuration.php#ini.mysqli.local-infile-directory" class="link">mysqli.local_infile_directory</a></td>
      <td class="empty">&nbsp;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td>自 PHP 8.1.0 起可用。</td>
     </tr>

     <tr>
      <td><a href="mysqli.configuration.php#ini.mysqli.allow-persistent" class="link">mysqli.allow_persistent</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="mysqli.configuration.php#ini.mysqli.max-persistent" class="link">mysqli.max_persistent</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="mysqli.configuration.php#ini.mysqli.max-links" class="link">mysqli.max_links</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="mysqli.configuration.php#ini.mysqli.default-port" class="link">mysqli.default_port</a></td>
      <td>&quot;3306&quot;</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="mysqli.configuration.php#ini.mysqli.default-socket" class="link">mysqli.default_socket</a></td>
      <td>NULL</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="mysqli.configuration.php#ini.mysqli.default-host" class="link">mysqli.default_host</a></td>
      <td>NULL</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="mysqli.configuration.php#ini.mysqli.default-user" class="link">mysqli.default_user</a></td>
      <td>NULL</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>自PHP 5.0.0起可用。</td>
     </tr>

     <tr>
      <td><a href="mysqli.configuration.php#ini.mysqli.default-pw" class="link">mysqli.default_pw</a></td>
      <td>NULL</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="mysqli.configuration.php#ini.mysqli.reconnect" class="link">mysqli.reconnect</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>自 PHP 8.2.0 起移除</td>
     </tr>

     <tr>
      <td><a href="mysqli.configuration.php#ini.mysqli.rollback-on-cached-plink" class="link">mysqli.rollback_on_cached_plink</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>

    </tbody>
   
  </table>

 </p>
 <p class="para">
 关于前面出现的 INI_* 系列常量的详细定义，请参阅<a href="configuration.changes.php" class="link">配置的修改</a>一章。
 </p>

 <p class="para">这是配置指令的简短说明。</p>

 <p class="para">
 <dl>
  
  
  
   <dt id="ini.mysqli.allow-local-infile">
    <code class="parameter">mysqli.allow_local_infile</code>
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
   </dt>
   <dd>
    <p class="para">
     允许Mysql的Load Data语句访问PHP角度看的本地文件。
    </p>
   </dd>
  

  
   <dt id="ini.mysqli.local-infile-directory">
    <code class="parameter">mysqli.local_infile_directory</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <p class="para">
     限制加载 LOCAL DATA 文件为指定的目录。
    </p>
   </dd>
  
  
  
   <dt id="ini.mysqli.allow-persistent">
    <code class="parameter">mysqli.allow_persistent</code>
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
   </dt>
   <dd>
    <p class="para">
    开启使用<span class="function"><a href="function.mysqli-connect.php" class="function">mysqli_connect()</a></span>函数创建持久化连接的能力。
    </p>
   </dd>
  
  
   <dt id="ini.mysqli.max-persistent">
    <code class="parameter">mysqli.max_persistent</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <p class="para">
    可以创建的持久化连接的最大数量，设置为0表明不限制。
    </p>
   </dd>
  
  
   <dt id="ini.mysqli.max-links">
    <code class="parameter">mysqli.max_links</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <p class="para">
    每个进程中Mysql连接的最大数量。
    </p>
   </dd>
  
   
   <dt id="ini.mysqli.default-port">
    <code class="parameter">mysqli.default_port</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <p class="para">
    当没有指定其他端口号时使用的默认的用于连接数据库服务器的TCP端口号。如果没有设置默认值，
    端口号将会按照顺序从环境变量<code class="literal">MYSQL_TCP_PORT</code>，<var class="filename">/etc/services</var>
    文件中的<code class="literal">mysql-tcp</code>条目或编译期的<code class="literal">MYSQL_PORT</code>常量等位置获取。
    Win32仅使用<code class="literal">MYSQL_PORT</code>常量。
    </p>
   </dd>
  
  
  
   <dt id="ini.mysqli.default-socket">
    <code class="parameter">mysqli.default_socket</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <p class="para">
    当连接到本地数据库服务器时如果没有指定其他socket名称，使用的默认socket名称。
    </p>
   </dd>
  
  
  

  
   
   <dt id="ini.mysqli.default-host">
    <code class="parameter">mysqli.default_host</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.mysqli.default-user">
    <code class="parameter">mysqli.default_user</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.mysqli.default-pw">
    <code class="parameter">mysqli.default_pw</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.mysqli.reconnect">
    <code class="parameter">mysqli.reconnect</code>
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   </dt>
   <dd>
    <p class="para">
    连接丢失时是否自动重新连接。
    </p>
    <blockquote class="note"><p><strong class="note">注意</strong>: 
     <span class="simpara">mysqlnd 驱动已此忽略此 <var class="filename">php.ini</var> 设置，并于 PHP 8.2.0 起移除。</span>
    </p></blockquote>
   </dd>
  

  
   <dt id="ini.mysqli.rollback-on-cached-plink">
    <code class="parameter">mysqli.rollback_on_cached_plink</code>
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
   </dt>
   <dd>
    <p class="para">
     If this option is enabled, closing a persistent connection will rollback
     any pending transactions of this connection before it is put back into the
     persistent connection pool. Otherwise, pending transactions will be rolled
     back only when the connection is reused, or when it is actually closed.
    </p>
   </dd>
  
  
 </dl>
 </p>
 <p class="para">
 用户不能通过API调用或运行时配置来设置<code class="literal">MYSQL_OPT_READ_TIMEOUT</code>。
 注意，如果可能这样做那么<code class="literal">libmysqlclient</code>和流对<code class="literal">MYSQL_OPT_READ_TIMEOUT</code>
 的值将会有不同的解释。 
 </p>
</div><?php manual_footer($setup); ?>