Tutorial on installing PHP's PDO mysql extension in CentOS

Source: Internet
Author: User
Tags install php

A tutorial network > operating system >>centos >centos install PHP in the PDO MySQL extension tutorials www.111cn.net edit: Bolshevik Source: Reprint days in the thinking of installing Drupal play a bit, The database options found in the installation process only support SQLite and no MySQL. Nani? Why is that? The results found that the installation of PDO MySQL was not caused by the compilation. So quickly update the lamp one-click installation script.

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for the PHP Access database. Each database driver that implements the PDO interface can expose the characteristics of a specific database as a standard extension feature. Note that using PDO to extend itself does not enable any database functionality; You must use the PDO driver for a specific database to access the database service.

Record the installation of the 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, it refers to the MySQL installation directory.
In addition, you need to use the –with-mysql-sock[=dir] parameter to set the extended UNIX socket pointer for all MySQL.

Finally, in my lamp one-click installation script, the parameters specified are as follows:

./configure--with-pdo-mysql--with-mysql-sock=/usr/local/mysql/mysql.sock


Currently, 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. After installing the PDO MySQL extension, the following phpinfo are included:

Method Two, configure separately


1, download the file or into the PHP source package into the Ext/pdo_mysql

Http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

2. Unzip the file
Tar zxvf pdo_mysql-1.0.2.tgz

3. Configuring and Compiling 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 installed in:/usr/local/mysql compile the time to pay attention to your own installation directory where
3, installed in the PHP configuration

Keep this in mind and then open the php.ini file,
and add a row

Extension=pdo_mysql.so

finally see a

Tutorial on installing PHP's PDO mysql extension in CentOS

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.