<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysqli.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'mysqli.options.php',
    1 => 'mysqli::options',
    2 => 'Set options',
  ),
  'up' => 
  array (
    0 => 'class.mysqli.php',
    1 => 'mysqli',
  ),
  'prev' => 
  array (
    0 => 'mysqli.next-result.php',
    1 => 'mysqli::next_result',
  ),
  'next' => 
  array (
    0 => 'mysqli.ping.php',
    1 => 'mysqli::ping',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysqli/mysqli/options.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli.options" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli::options</h1>
  <h1 class="refname">mysqli_options</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mysqli::options</span> -- <span class="refname">mysqli_options</span> &mdash; <span class="dc-title">Set options</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli.options-description">
  <h3 class="title">Description</h3>
  <p class="para">Object-oriented style</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysqli::options</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$option</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">Procedural style</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>mysqli_options</strong></span>(<span class="methodparam"><span class="type"><a href="class.mysqli.php" class="type mysqli">mysqli</a></span> <code class="parameter">$mysql</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$option</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Used to set extra connect options and affect behavior for a connection.
  </p>
  <p class="para">
   This function may be called multiple times to set several options.
  </p>
  <p class="para">
   <span class="function"><strong>mysqli_options()</strong></span> should be called after
   <span class="function"><a href="mysqli.init.php" class="function">mysqli_init()</a></span> and before
   <span class="function"><a href="mysqli.real-connect.php" class="function">mysqli_real_connect()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli.options-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">mysql</code></dt><dd><p class="para">Procedural style only: A <span class="classname"><a href="class.mysqli.php" class="classname">mysqli</a></span> object
returned by <span class="function"><a href="function.mysqli-connect.php" class="function">mysqli_connect()</a></span> or <span class="function"><a href="mysqli.init.php" class="function">mysqli_init()</a></span>
</p></dd>
    
     <dt><code class="parameter">option</code></dt>
     <dd>
      <p class="para">
       The option that you want to set. It can be one of the following values:
       <table id="mysqli.options.parameters" class="doctable table">
        <caption><strong>Valid options</strong></caption>
        
         <thead>
          <tr>
           <th>Name</th>
           <th>Description</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-connect-timeout">MYSQLI_OPT_CONNECT_TIMEOUT</a></code></strong></td>
           <td>Connection timeout in seconds</td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-read-timeout">MYSQLI_OPT_READ_TIMEOUT</a></code></strong></td>
           <td>Command execution result timeout in seconds. Available as of PHP 7.2.0.</td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-local-infile">MYSQLI_OPT_LOCAL_INFILE</a></code></strong></td>
           <td>Enable/disable use of <code class="literal">LOAD LOCAL INFILE</code></td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-load-data-local-dir">MYSQLI_OPT_LOAD_DATA_LOCAL_DIR</a></code></strong></td>
           <td>
            Directory to be used for <code class="literal">LOAD DATA LOCAL INFILE</code>.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-init-command">MYSQLI_INIT_COMMAND</a></code></strong></td>
           <td>Command to execute after when connecting to MySQL server</td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-set-charset-name">MYSQLI_SET_CHARSET_NAME</a></code></strong></td>
           <td>The charset to be set as default.</td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-read-default-file">MYSQLI_READ_DEFAULT_FILE</a></code></strong></td>
           <td>
            Read options from named option file instead of <var class="filename">my.cnf</var>
            Not supported by mysqlnd.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-read-default-group">MYSQLI_READ_DEFAULT_GROUP</a></code></strong></td>
           <td>
            Read options from the named group from <var class="filename">my.cnf</var>
            or the file specified with <strong><code>MYSQL_READ_DEFAULT_FILE</code></strong>.
            Not supported by mysqlnd.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-server-public-key">MYSQLI_SERVER_PUBLIC_KEY</a></code></strong></td>
           <td>
             RSA public key file used with the SHA-256 based authentication.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-net-cmd-buffer-size">MYSQLI_OPT_NET_CMD_BUFFER_SIZE</a></code></strong></td>
           <td>
             The size of the internal command/network buffer. Only valid for
             mysqlnd.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-net-read-buffer-size">MYSQLI_OPT_NET_READ_BUFFER_SIZE</a></code></strong></td>
           <td>
             Maximum read chunk size in bytes when reading the body of a MySQL
             command packet. Only valid for mysqlnd.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-int-and-float-native">MYSQLI_OPT_INT_AND_FLOAT_NATIVE</a></code></strong></td>
           <td>
             Convert integer and float columns back to PHP numbers when using non-prepared statements.
             Only valid for mysqlnd.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-ssl-verify-server-cert">MYSQLI_OPT_SSL_VERIFY_SERVER_CERT</a></code></strong></td>
           <td>
            Whether to verify server certificate or not.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="mysqli.constants.php#constant.mysqli-opt-can-handle-expired-passwords">MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS</a></code></strong></td>
           <td>
            Whether the client should accept expired passwords.
           </td>
          </tr>

          <tr>
           <td><code class="literal">1</code></td>
           <td>
            Whether to use network communication compression.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The value for the option.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysqli.options-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mysqli.options-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
If mysqli error reporting is enabled (<strong><code><a href="mysqli.constants.php#constant.mysqli-report-error">MYSQLI_REPORT_ERROR</a></code></strong>) and the requested operation fails,
a warning is generated. If, in addition, the mode is set to <strong><code><a href="mysqli.constants.php#constant.mysqli-report-strict">MYSQLI_REPORT_STRICT</a></code></strong>,
a <span class="classname"><a href="class.mysqli-sql-exception.php" class="classname">mysqli_sql_exception</a></span> is thrown instead.</p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysqli.options-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   See <span class="function"><a href="mysqli.real-connect.php" class="function">mysqli_real_connect()</a></span>.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-mysqli.options-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
<p class="para">MySQLnd always assumes the server default charset. This charset is sent during connection
hand-shake/authentication, which mysqlnd will use.</p><p class="para">Libmysqlclient uses the default charset set in the
<var class="filename">my.cnf</var> or by an explicit call to <span class="function"><strong>mysqli_options()</strong></span> prior to
calling <span class="function"><a href="mysqli.real-connect.php" class="function">mysqli_real_connect()</a></span>, but after <span class="function"><a href="mysqli.init.php" class="function">mysqli_init()</a></span>.</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli.options-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli.init.php" class="function" rel="rdfs-seeAlso">mysqli_init()</a> - Initializes MySQLi and returns an object for use with mysqli_real_connect()</span></li>
    <li><span class="function"><a href="mysqli.real-connect.php" class="function" rel="rdfs-seeAlso">mysqli_real_connect()</a> - Opens a connection to the MySQL server</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>