diff --git a/reference/mysql/configure.xml b/reference/mysql/configure.xml index ebe14c41fa..e1cbb0df83 100644 --- a/reference/mysql/configure.xml +++ b/reference/mysql/configure.xml @@ -40,7 +40,7 @@
- PHP 5+ + PHP 5.0.x, 5.1.x, 5.2.x MySQL is not enabled by default, nor is the MySQL library bundled with PHP. Read this @@ -51,6 +51,20 @@ MySQL.
+
+ PHP 5.3.0+ + + In PHP 5.3.0 and above the MySQL-related database extensions use the + MySQL Native Driver + by default. This means that the MySQL Client Library (libmysql) + is no longer required in order to support connection to a MySQL database. The extensions + mysql, mysqli, and PHP_PDO_MYSQL are + all enabled by default in PHP 5.3.0+, and all use the MySQL Native Driver by default. In each + case no further installation steps are required in order to use these extensions, although + you may want to set some preferences in php.ini depending on your + requirements. + +
@@ -62,7 +76,7 @@
- PHP 5+ + PHP 5.0.x, 5.1.x, 5.2.x MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of @@ -94,6 +108,13 @@
+
+ PHP 5.3.0+ + + Please refer to these notes on + installing MySQL support on PHP 5.3.0 and above. + +
diff --git a/reference/mysqli/configure.xml b/reference/mysqli/configure.xml index b64ed72316..abeb0a6d6c 100644 --- a/reference/mysqli/configure.xml +++ b/reference/mysqli/configure.xml @@ -4,84 +4,110 @@ &reftitle.install; - - As of PHP 5.0, MySQL support is no longer enabled by default with the - standard PHP distributions. This means PHP needs to be explicitly - configured to take advantage of the MySQL extensions. + + Versions of PHP since 5.3.0 have MySQL support enabled as standard through the + use of the mysql, mysqli, and + PHP_PDO_MYSQL extensions. Each of these extensions + now uses the MySQL Native Driver by + default, rather than the MySQL Client Library, libmysql. - The common Unix distributions include binary versions of PHP that can - be installed. Although these binary versions are typically built with - support for MySQL extensions enabled, the extension libraries - themselves may need to be installed using an additional package. Check - the package manager than comes with your chosen distribution for - availability. + Versions 5.0, 5.1 and 5.2 of PHP, did not have MySQL support + enabled by default. These versions of PHP require MySQL support + to be explicitly configured, as they required use of the + MySQL Client Library. - Unless your Unix distribution comes with a binary package of PHP with - the mysqli extension available, you will need to - build PHP from source code. Building PHP from source allows you to - specify the MySQL extensions you want to use, as well as your choice - of client library for each extension. + The mysqli extension was introduced with PHP version + 5.0.0. The MySQL Native Driver was included in PHP version 5.3.0. - - To ensure that the mysqli extension for PHP is - enabled, you will need to configure the PHP source code to use - mysqli. This is achieved by running the - configure script with the option - , - prior to building PHP. This will enable mysqli and - it will use the MySQL Client Library (libmysql) to communicate with - the MySQL Server. - +
+ + Installation on Linux - - The mysql_config_path represents the location of - the mysql_config program that comes with MySQL - Server. + The common Unix distributions include binary versions of PHP that can + be installed. Although these binary versions are typically built with + support for MySQL extensions enabled, the extension libraries + themselves may need to be installed using an additional package. Check + the package manager than comes with your chosen distribution for + availability. - - - With versions of PHP 5.3 and newer, you can alternatively use the new - MySQL Native Driver with mysqli. This gives a - number of benefits over using libmysql. - + + Unless your Unix distribution comes with a binary package of PHP with + the mysqli extension available, you will need to + build PHP from source code. Building PHP from source allows you to + specify the MySQL extensions you want to use, as well as your choice + of client library for each extension. + - - To use MySQL Native Driver with mysqli you need to - configure the PHP source code using the - option, prior - to building PHP. - +
- - This is the recommended option, as using the MySQL Native Driver - results in improved performance and gives access to features not - available when using the MySQL Client Library. Refer to - What is PHP's MySQL Native - Driver? for a brief overview of the advantages of MySQL Native - Driver. - + PHP 5.0, 5.1, 5.2 - - Note that it is possible to freely mix MySQL extensions and client - libraries. For example, it is possible to enable the MySQL extension - to use the MySQL Client Library (libmysql), while configuring the - mysqli extension to use the MySQL Native Driver. - However, all permutations of extension and client library are - possible. - + + If building from source code, to ensure that the mysqli + extension for PHP is enabled, you will need to configure the PHP source code to use + mysqli. This is achieved by running the + configure script with the option + , + prior to building PHP. This will enable mysqli and + it will use the MySQL Client Library (libmysql) to communicate with + the MySQL Server. + - - The following example builds the MySQL extension to use the MySQL - Client Library, and the mysqli and PDO MYSQL - extensions to use the MySQL Native Driver: - + + The mysql_config_path represents the location of + the mysql_config program that comes with MySQL + Server. + + +
+ +
+ + PHP 5.3.0+ + + + With versions of PHP 5.3.0 and newer, mysqli uses + MySQL Native Driver by default. This gives a number of benefits over + libmysql. + + + + This is the recommended option, as using the MySQL Native Driver + results in improved performance and gives access to features not + available when using the MySQL Client Library. Refer to + What is PHP's MySQL Native + Driver? for a brief overview of the advantages of MySQL Native + Driver. + + + + To use MySQL Native Driver with mysqli you need to + configure the PHP source code using the + option, prior + to building PHP. + + + + Note that it is possible to freely mix MySQL extensions and client + libraries. For example, it is possible to enable the MySQL extension + to use the MySQL Client Library (libmysql), while configuring the + mysqli extension to use the MySQL Native Driver. + However, all permutations of extension and client library are + possible. + + + + The following example builds the MySQL extension to use the MySQL + Client Library, and the mysqli and PDO MYSQL + extensions to use the MySQL Native Driver: + ./configure --with-mysql=/usr/bin/mysql_config \ @@ -90,71 +116,90 @@ [other options] +
+ +
+
Installation on Windows Systems On Windows, PHP is most commonly installed using the binary - installer. Once PHP has been installed, some configuration is - required to enable mysqli and specify the client - library you want it to use. + installer. - - As mentioned earlier, the mysqli extension is not - enabled by default, so the php_mysqli.dll DLL - must be enabled inside of &php.ini;. In order to do this you need to - find the &php.ini; file (typically located in - c:\php), and make sure you remove the comment - (semi-colon) from the start of the line - extension=php_mysqli.dll, in the section marked - [PHP_MYSQLI]. - +
- - Also, if you want to use the MySQL Client Library with - mysqli, you need to make sure PHP can access the - client library file. The MySQL Client Library is included as a file - named libmysql.dll in the Windows PHP - distribution. This file needs to be available in the Windows system's - PATH environment variable, so that it can be - successfully loaded. See the FAQ titled - "How do I add my PHP - directory to the PATH on Windows" for information on how to do - this. Copying libmysql.dll to the Windows system - directory (typically c:\Windows\system) also - works, as the system directory is by default in the system's - PATH. However, this practice is strongly discouraged. - + PHP 5.0, 5.1, 5.2 - - On Windows, for PHP versions 5.3 and newer, the - mysqli extension uses the MySQL Native Driver by - default. This means you don't need to worry about configuring access - to libmysql.dll, you just need to make sure the - extension is enabled in the &php.ini; file. - - - - As with enabling any PHP extension (such as - php_mysqli.dll), the PHP directive - extension_dir should be set - to the directory where the PHP extensions are located. See also the - Manual Windows Installation - Instructions. An example extension_dir - value for PHP 5 is c:\php\ext. - - - - If when starting the web server an error similar to the following - occurs: "Unable to load dynamic library - './php_mysqli.dll'", this is because - php_mysqli.dll and/or - libmysql.dll cannot be found by the system. + Once PHP has been installed, some configuration is + required to enable mysqli and specify the client + library you want it to use. - + + + The mysqli extension is not + enabled by default, so the php_mysqli.dll DLL + must be enabled inside of &php.ini;. In order to do this you need to + find the &php.ini; file (typically located in + c:\php), and make sure you remove the comment + (semi-colon) from the start of the line + extension=php_mysqli.dll, in the section marked + [PHP_MYSQLI]. + + + + Also, if you want to use the MySQL Client Library with + mysqli, you need to make sure PHP can access the + client library file. The MySQL Client Library is included as a file + named libmysql.dll in the Windows PHP + distribution. This file needs to be available in the Windows system's + PATH environment variable, so that it can be + successfully loaded. See the FAQ titled + "How do I add my PHP + directory to the PATH on Windows" for information on how to do + this. Copying libmysql.dll to the Windows system + directory (typically c:\Windows\system) also + works, as the system directory is by default in the system's + PATH. However, this practice is strongly discouraged. + + + + As with enabling any PHP extension (such as + php_mysqli.dll), the PHP directive + extension_dir should be set + to the directory where the PHP extensions are located. See also the + Manual Windows Installation + Instructions. An example extension_dir + value for PHP 5 is c:\php\ext. + + + + + If when starting the web server an error similar to the following + occurs: "Unable to load dynamic library + './php_mysqli.dll'", this is because + php_mysqli.dll and/or + libmysql.dll cannot be found by the system. + + +
+ +
+ + PHP 5.3.0+ + + + On Windows, for PHP versions 5.3 and newer, the + mysqli extension is enabled and + uses the MySQL Native Driver by default. This means you don't need to + worry about configuring access + to libmysql.dll. + + +