<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Set options</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqli.next-result.html">mysqli::next_result</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli.ping.html">mysqli::ping</a></div> <div class="up"><a href="class.mysqli.html">mysqli</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><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)</p><p class="refpurpose"><span class="refname">mysqli::options</span> -- <span class="refname">mysqli_options</span> — <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="type">bool</span> <span class="methodname"><strong>mysqli::options</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span> )</div> <p class="para rdfs-comment">Procedural style</p> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>mysqli_options</strong></span> ( <span class="methodparam"><span class="type"><a href="class.mysqli.html" class="type mysqli">mysqli</a></span> <code class="parameter">$link</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></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.html" class="function">mysqli_init()</a></span> and before <span class="function"><a href="mysqli.real-connect.html" 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> <span class="term"><em><code class="parameter"> link</code></em></span><dd> <p class="para">Procedural style only: A link identifier returned by <span class="function"><a href="function.mysqli-connect.html" class="function">mysqli_connect()</a></span> or <span class="function"><a href="mysqli.init.html" class="function">mysqli_init()</a></span> </p></dd> </dt> <dt> <span class="term"><em><code class="parameter">option</code></em></span> <dd> <p class="para"> The option that you want to set. It can be one of the following values: <table 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>MYSQLI_OPT_CONNECT_TIMEOUT</code></strong></td> <td>connection timeout in seconds (supported on Windows with TCP/IP since PHP 5.3.1)</td> </tr> <tr> <td><strong><code>MYSQLI_OPT_LOCAL_INFILE</code></strong></td> <td>enable/disable use of <em>LOAD LOCAL INFILE</em></td> </tr> <tr> <td><strong><code>MYSQLI_INIT_COMMAND</code></strong></td> <td>command to execute after when connecting to MySQL server</td> </tr> <tr> <td><strong><code>MYSQLI_READ_DEFAULT_FILE</code></strong></td> <td> Read options from named option file instead of <var class="filename">my.cnf</var> </td> </tr> <tr> <td><strong><code>MYSQLI_READ_DEFAULT_GROUP</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>. </td> </tr> <tr> <td><strong><code>MYSQLI_SERVER_PUBLIC_KEY</code></strong></td> <td> RSA public key file used with the SHA-256 based authentication. </td> </tr> </tbody> </table> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">value</code></em></span> <dd> <p class="para"> The value for the option. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-mysqli.options-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 changelog" id="refsect1-mysqli.options-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.5.0</td> <td> The <strong><code>MYSQLI_SERVER_PUBLIC_KEY</code></strong> option was added. </td> </tr> </tbody> </table> </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.html" 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.html" class="function">mysqli_real_connect()</a></span>, but after <span class="function"><a href="mysqli.init.html" 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 class="member"> <span class="function"><a href="mysqli.init.html" class="function" rel="rdfs-seeAlso">mysqli_init()</a> - Initializes MySQLi and returns a resource for use with mysqli_real_connect()</span></li> <li class="member"> <span class="function"><a href="mysqli.real-connect.html" class="function" rel="rdfs-seeAlso">mysqli_real_connect()</a> - Opens a connection to a mysql server</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqli.next-result.html">mysqli::next_result</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli.ping.html">mysqli::ping</a></div> <div class="up"><a href="class.mysqli.html">mysqli</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>