PHP 5.0, 5.1, 5.2
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 MariaDB Client Library with mysqli
, you need to make sure PHP can access the client library file. The MariaDB 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
.Note
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.