tutorial on installing PHP PDO MySQL extensions in CentOS

Source: Internet
Author: User
Tags centos

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.