Building Chinese Web Sites using PHP
Dr. Herong Yang, Version 2.11

php_mysql.dll - Configuring PHP to Use MySQL Module

This section describes how to configure PHP load MySQL module, php_mysql.dll, to use MySQL functions.

If you want to access MySQL database servers from PHP scripts, you need to use MySQL functions provided by the MySQL module, php_mysql.dll. This tutorial shows you how to load and config php_mbstring.dll.

1. Check the PHP configuration file, \local\php\php.ini. If not exist, copy it from \local\php\php.ini-dist:

C:\> copy \local\php\php.ini-dist \local\php\php.ini

2. Open \local\php\php.ini in a text editor, like notepad.

3. Change the setting to allow PHP to load php_mysql.dll from the \local\php\ext directory:

...
;extension_dir = "./"
extension_dir = "./ext"
...
;extension=php_mysql.dll
extension=php_mysql.dll
...

The following settings in php.ini file are used by MySQL module. You can take the default values:

mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

Sections in This Chapter

php_mysql.dll - Configuring PHP to Use MySQL Module

Commonly Used MySQL Functions

mysql_connect() - Creating MySQL Connections

INSERT INTO - Inserting New Records

SELECT - Running Database Queries

UPDATE - Modifying Database Records

Dr. Herong Yang, updated in 2007
php_mysql.dll - Configuring PHP to Use MySQL Module