<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mysql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'mysqlinfo.library.choosing.php',
    1 => 'Choosing a library',
    2 => 'Choosing a library',
  ),
  'up' => 
  array (
    0 => 'mysql.php',
    1 => 'Overview of the MySQL PHP drivers',
  ),
  'prev' => 
  array (
    0 => 'mysqlinfo.api.choosing.php',
    1 => 'Choosing an API',
  ),
  'next' => 
  array (
    0 => 'mysqlinfo.concepts.php',
    1 => 'Concepts',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysqlinfo/set.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqlinfo.library.choosing" class="chapter">
   <h1 class="title">Choosing a library</h1>

   <p class="simpara">
    The mysqli and PDO_MySQL PHP extensions are lightweight wrappers on
    top of a C client library. The extensions can either use the
    <a href="book.mysqlnd.php" class="link">mysqlnd</a> library or the <code class="literal">libmysqlclient</code>
    library. Choosing a library is a compile time decision.
   </p>
   <p class="simpara">
    The mysqlnd library is part of the PHP distribution. It offers
    features like lazy connections and query caching, features that are not available
    with libmysqlclient, so using the built-in mysqlnd library is highly recommended.
    See the <a href="book.mysqlnd.php" class="link">mysqlnd documentation</a> for
    additional details, and a listing of features and functionality that it offers.
   </p>
   <div class="example" id="example-1">
    <p><strong>Example #1 Configure commands for using mysqlnd or libmysqlclient</strong></p>
    <div class="example-contents">
<div class="shellcode"><pre class="shellcode">// Recommended, compiles with mysqlnd
$ ./configure --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd

// Alternatively recommended, compiles with mysqlnd
$ ./configure --with-mysqli --with-pdo-mysql

// Not recommended, compiles with libmysqlclient
$ ./configure --with-mysqli=/path/to/mysql_config --with-pdo-mysql=/path/to/mysql_config</pre>
</div>
    </div>

   </div>
   <p class="simpara">
    <strong>Library feature comparison</strong>
   </p>
   <p class="simpara">
    It is recommended to use the <a href="book.mysqlnd.php" class="link">mysqlnd</a>
    library instead of the MySQL Client Server library (libmysqlclient). Both
    libraries are supported and constantly being improved.
   </p>
   <table id="mysqlinfo.library.choosing.changelog" class="doctable informaltable">
    
     <thead>
      <tr>
       <th class="empty">&nbsp;</th>
       <th>MySQL native driver (<a href="book.mysqlnd.php" class="link">mysqlnd</a>)</th>
       <th>MySQL client server library (<code class="literal">libmysqlclient</code>)</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>Part of the PHP distribution</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>PHP version introduced</td>
       <td>5.3.0</td>
       <td>N/A</td>
      </tr>

      <tr>
       <td>License</td>
       <td>PHP License 3.01</td>
       <td>Dual-License</td>
      </tr>

      <tr>
       <td>Development status</td>
       <td>Active</td>
       <td>Active</td>
      </tr>

      <tr>
       <td>Lifecycle</td>
       <td>No end announced</td>
       <td>No end announced</td>
      </tr>

      <tr>
       <td>Compile default (for all MySQL extensions)</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>Compression protocol support</td>
       <td>Yes</td>
       <td>Yes</td>
      </tr>

      <tr>
       <td>SSL support</td>
       <td>Yes</td>
       <td>Yes</td>
      </tr>

      <tr>
       <td>Named pipe support</td>
       <td>Yes</td>
       <td>Yes</td>
      </tr>

      <tr>
       <td>Non-blocking, asynchronous queries</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>Performance statistics</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>LOAD LOCAL INFILE respects the <a href="ini.core.php#ini.open-basedir" class="link">open_basedir directive</a></td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>Uses PHP&#039;s native memory management system (e.g., follows PHP memory limits)</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>Return numeric column as double (COM_QUERY)</td>
       <td>Yes</td>
       <td>No</td>
      </tr>

      <tr>
       <td>Return numeric column as string (COM_QUERY)</td>
       <td>Yes</td>
       <td>Yes</td>
      </tr>

      <tr>
       <td>Plugin API</td>
       <td>Yes</td>
       <td>Limited</td>
      </tr>

      <tr>
       <td>Automatic reconnect</td>
       <td>No</td>
       <td>Optional</td>
      </tr>

     </tbody>
    
   </table>

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