<!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>Installation</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysql.requirements.html">Requirements</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysql.configuration.html">Runtime Configuration</a></div> <div class="up"><a href="mysql.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mysql.installation" class="section"> <h2 class="title">Installation</h2> <p class="para" id="mysql.configure"> For compiling, simply use the <strong class="option configure">--with-mysql[=DIR]</strong> configuration option where the optional <em>[DIR]</em> points to the MySQL installation directory. </p> <p class="para"> Although this MySQL extension is compatible with MySQL 4.1.0 and greater, it doesn't support the extra functionality that these versions provide. For that, use the <a href="book.mysqli.html" class="link">MySQLi</a> extension. </p> <p class="para"> If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts. </p> <div class="section" id="mysql.installation.linux"> <h2 class="title">Installation on Linux Systems</h2> <p class="para"> Note: <em>[DIR]</em> is the path to the MySQL client library files (<em class="emphasis">headers and libraries</em>), which can be downloaded from <a href="http://www.mysql.com/" class="link external">» MySQL</a>. </p> <table class="doctable table"> <caption><strong>ext/mysql compile time support matrix</strong></caption> <thead> <tr> <th>PHP Version</th> <th>Default</th> <th>Configure Options: <a href="mysqlnd.overview.html" class="link">mysqlnd</a></th> <th>Configure Options: <em>libmysqlclient</em></th> <th>Changelog</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.x.x</td> <td>libmysqlclient</td> <td>Not Available</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>libmysqlclient</td> <td>Not Available</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 <a href="faq.databases.html#faq.databases.mysql.php5" class="link">no longer bundled</a> </td> </tr> <tr> <td>5.3.x</td> <td>libmysqlclient</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">Installation on Windows Systems</h2> <div class="section"> <h2 class="title">PHP 4</h2> <p class="para"> The PHP MySQL extension is compiled into PHP. </p> </div> <div class="section"> <h2 class="title">PHP 5.0.x, 5.1.x, 5.2.x</h2> <p class="para"> MySQL is no longer enabled by default, so the <var class="filename">php_mysql.dll</var> DLL must be enabled inside of <var class="filename">php.ini</var>. Also, PHP needs access to the MySQL client library. A file named <var class="filename">libmysql.dll</var> is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems <span class="envar">PATH</span>. See the FAQ titled "<a href="faq.installation.html#faq.installation.addtopath" class="link">How do I add my PHP directory to the <var class="varname"><var class="varname">PATH</var></var> on Windows</a>" for information on how to do this. Although copying <var class="filename">libmysql.dll</var> to the Windows system directory also works (because the system directory is by default in the system's <span class="envar">PATH</span>), it's not recommended. </p> <p class="para"> As with enabling any PHP extension (such as <var class="filename">php_mysql.dll</var>), the PHP directive <a href="ini.core.html#ini.extension-dir" class="link">extension_dir</a> should be set to the directory where the PHP extensions are located. See also the <a href="install.windows.manual.html" class="link">Manual Windows Installation Instructions</a>. An example extension_dir value for PHP 5 is <em>c:\php\ext</em> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> If when starting the web server an error similar to the following occurs: <em>"Unable to load dynamic library './php_mysql.dll'"</em>, this is because <var class="filename">php_mysql.dll</var> and/or <var class="filename">libmysql.dll</var> cannot be found by the system. </p> </p></blockquote> </div> <div class="section"> <h2 class="title">PHP 5.3.0+</h2> <p class="para"> The <a href="mysqlnd.overview.html" 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 Installation Notes</h2> <div class="warning"><strong class="warning">Warning</strong> <p class="para"> Crashes and startup problems of PHP may be encountered when loading this extension in conjunction with the recode extension. See the <a href="ref.recode.html" class="link">recode</a> extension for more information. </p> </div> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> If you need charsets other than <em class="emphasis">latin</em> (default), you have to install external (not bundled) libmysqlclient with compiled charset support. </p> </p></blockquote> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysql.requirements.html">Requirements</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysql.configuration.html">Runtime Configuration</a></div> <div class="up"><a href="mysql.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>