The PHP Data Objects (PDO) Extension defines a lightweight consistent interface for PHP to access the database. Each database driver implementing the PDO interface can expose the features of a specific database as a standard extension function. Note that using PDO extension itself cannot implement any database functions; you must use the PDO driver of a specific database to access the database service.
Record the PDO MySQL extension installation process.
You can install the pdo mysql extension by adding the-with-PDO-MySQL [= DIR] parameter when compiling and installing PHP. [= DIR] is an optional installation directory for MySQL.
In addition, you must use the-with-mysql-sock [= DIR] parameter to set the extended unix socket pointer of all MySQL instances.
Finally, in my LAMP one-click installation script, the specified parameters are as follows:
./Configure -- with-pdo-mysql -- with-mysql-sock =/usr/local/mysql. sock
Currently, the LAMP one-click installation script has been updated. If you have already installed the script, you can run the update. sh script and re-compile and install it once. The phpinfo after the PDO MySQL extension is installed is as follows:
Method 2: Separate Configuration
For more details, see http://www.bKjia. c0m/sys/CentOS/56849.htm
1. download the file or enter ext/pdo_mysql in the PHP source package
Http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
2. decompress the file
Tar zxvf PDO_MYSQL-1.0.2.tgz
3. Configure and compile files
Cd PDO_MYSQL-1.0.2
/Usr/local/php/bin/phpize
./Configure-with-php-config =/usr/local/php/bin/php-config-with-pdo-mysql =/usr/local/mysql
Make
Make install
Note: My PHP is installed in:/usr/local/php/mysql. When installing:/usr/local/mysql, pay attention to where your own installation directory is.
3. install it in PHP configuration
Remember this and open the php. ini file,
Add a row
Extension = pdo_mysql.so
Last read