The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for PHP access to the database. Each database driver that implements the PDO interface can expose specific database features as standard extension functions. Note that using PDO to extend itself does not implement any database functionality; The database service must be accessed using a PDO driver of a specific database.
Record installation PDO MySQL extension process.
Referring to the official installation documentation, you can install the PDO MySQL extension by adding the –with-pdo-mysql[=dir] parameter when compiling and installing PHP. where [=dir] is optional, refers to the MySQL installation directory.
In addition, you need to use the –with-mysql-sock[=dir] parameter to set all the extended UNIX socket pointers for MySQL.
Finally, in my lamp one-click setup script, the parameters specified are as follows:
./configure--with-pdo-mysql--with-mysql-sock=/usr/local/mysql/mysql.sock
At present, the lamp one-click installation script has been updated. Users who have already installed the script can run the update.sh script and recompile the installation once. Attached after installing the PDO MySQL extended phpinfo screenshot as follows:
Method two, individually configured
1, download files or enter the PHP source package into the Ext/pdo_mysql
Http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
2, Extract files
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 installation in:/usr/local/php/mysql installed in:/usr/local/mysql compile time to pay attention to your own installation directory where
3, install to the PHP configuration
Keep this in mind, and then open the php.ini file,
and add a row
Extension=pdo_mysql.so
Last look at a screenshot