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

contributors($setup);

?>
<div id="mysql.installation" class="section">
 <h2 class="title">安装</h2>

 <div class="warning"><strong class="warning">警告</strong>
  <p class="para">本扩展自 PHP 5.5.0
起已废弃，并在自 PHP 7.0.0 开始被移除。应使用 <a href="book.mysqli.php" class="link">MySQLi</a>
或 <a href="ref.pdo-mysql.php" class="link">PDO_MySQL</a> 扩展来替换之。参见 <a href="mysqlinfo.api.choosing.php" class="link">MySQL：选择 API</a> 
指南来获取更多信息。用以替代本函数的有：</p>
 </div>

 <p class="simpara" id="mysql.configure">
  编译时，只要使用
  <strong class="option configure">--with-mysql[=DIR]</strong>
  配置选项即可，其中可选的
  <code class="literal">[DIR]</code> 指向 MySQL 的安装目录。
 </p>
 <p class="simpara">
  虽然本 MySQL 扩展库兼容 MySQL 4.1.0
  及其以后版本，但是它不支持这些版本提供的额外功能。要使用这些功能，请使用
  <a href="book.mysqli.php" class="link">MySQLi</a> 扩展库。
 </p>
 <p class="simpara">
  如果要同时安装 mysql 扩展库和 mysqli 扩展库，必须使用同一个客户端库以避免任何冲突。
 </p>

 <div class="section" id="mysql.installation.linux">
  <h2 class="title">在 Linux 系统下安装</h2>
  <p class="simpara">
   Note: <code class="literal">[DIR]</code> is the path to the MySQL client library
   files (<em>headers and libraries</em>), which can be downloaded from
   <a href="http://www.mysql.com/" class="link external">&raquo;&nbsp;MySQL</a>.
  </p>
  <table id="mysql.installation.compile.support" class="doctable table">
   <caption><strong>ext/mysql compile time support matrix</strong></caption>
   
    <thead>
     <tr>
      <th>PHP 版本</th>
      <th>默认</th>
      <th>配置选项: <a href="mysqlnd.overview.php" class="link">mysqlnd</a></th>
      <th>配置选项: <code class="literal">libmysql</code></th>
      <th>更新日志</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>4.x.x</td>
      <td>libmysql</td>
      <td>不适用</td>
      <td><strong class="option configure">--without-mysql</strong> to disable</td>
      <td>MySQL enabled by default, MySQL client libraries are bundled</td>
     </tr>

     <tr>
      <td>5.0.x, 5.1.x, 5.2.x</td>
      <td>libmysql</td>
      <td>不适用</td>
      <td><strong class="option configure">--with-mysql=[DIR]</strong></td>
      <td>
       MySQL is no longer enabled by default, and the MySQL client libraries
       are no longer bundled
      </td>
     </tr>

     <tr>
      <td>5.3.x</td>
      <td>libmysql</td>
      <td><strong class="option configure">--with-mysql=mysqlnd</strong></td>
      <td><strong class="option configure">--with-mysql=[DIR]</strong></td>
      <td>mysqlnd is now available</td>
     </tr>

     <tr>
      <td>5.4.x</td>
      <td>mysqlnd</td>
      <td><strong class="option configure">--with-mysql</strong></td>
      <td><strong class="option configure">--with-mysql=[DIR]</strong></td>
      <td>mysqlnd is now the default</td>
     </tr>

    </tbody>
   
  </table>

 </div>

 <div class="section" id="mysql.installation.windows">
  <h2 class="title">在 Windows 系统下安装</h2>
  <div class="section">
   <h2 class="title">PHP 5+</h2>
   <p class="simpara">
    MySQL 默认未启用，因此必须在 <var class="filename">php.ini</var> 中激活
    <var class="filename">php_mysql.dll</var> 动态连接库。此外，PHP
    还需要访问 MySQL 客户端连接库。PHP 的 Windows
    发行版包括了一个
    <var class="filename">libmysql.dll</var>，为了让 PHP 能和
    MySQL 对话，此文件必须放在 Windows 的系统路径
    <var class="envar">PATH</var> 中。怎样做见 FAQ
    中的“<a href="faq.installation.php#faq.installation.addtopath" class="link">怎样把 PHP
    目录加入到 Windows <var class="varname">PATH</var>中</a>”。尽管将
    <var class="filename">libmysql.dll</var> 拷贝到 Windows
    系统目录中也可以（因为系统目录默认在系统路径
    <var class="envar">PATH</var> 中），但不推荐这样做。
   </p>
   <p class="simpara">
    要激活任何 PHP 扩展库（例如
    <var class="filename">php_mysql.dll</var>），PHP 指令
    <a href="ini.core.php#ini.extension-dir" class="link">extension_dir</a>
    要被设为 PHP 扩展库所在的目录。参见<a href="install.windows.manual.php" class="link">手工 Windows
    安装指南</a>。PHP 5 下 extension_dir 取值的一个例子是
    <code class="literal">c:\php\ext</code>。
   </p>
   <blockquote class="note"><p><strong class="note">注意</strong>: 
    <span class="simpara">
     如果启动 web 服务器时出现类似如下的错误：<code class="literal">&quot;Unable
     to load dynamic library &#039;./php_mysql.dll&#039;&quot;</code>，这是因为系统找不到
     <var class="filename">php_mysql.dll</var> 和／或
     <var class="filename">libmysql.dll</var>。
    </span>
   </p></blockquote>
  </div>
  <div class="section">
   <h2 class="title">PHP 5.3.0+</h2>
   <p class="simpara">
    The <a href="mysqlnd.overview.php" class="link">MySQL Native Driver</a> is enabled by
    default. Include <var class="filename">php_mysql.dll</var>, but <var class="filename">libmysql.dll</var>
    is no longer required or used.
   </p>
  </div>
 </div>

 <div class="section" id="mysql.installation.notes">
  <h2 class="title">MySQL 安装注意事项</h2>
   <div class="warning"><strong class="warning">警告</strong>
    <p class="simpara">
     当同时加在本扩展库和 recode 扩展库时 PHP 可能会崩溃。更多信息见
     <a href="ref.recode.php" class="link">recode</a> 扩展库。
    </p>
   </div>
   <blockquote class="note"><p><strong class="note">注意</strong>: 
    <span class="simpara">
     如果需要不同于
     <em>latin</em>（默认值）的字符集，必须安装外部的（非绑定的）已编译入所需字符集支持的
     libmysql。
    </span>
   </p></blockquote>
 </div>
</div><?php manual_footer($setup); ?>