Installing the Pdo_mysql extension on Linux CENTOS6

Source: Internet
Author: User
Tags install php phpinfo

CentOS6 How to let the installation configuration PDO support MySQL?

Project Run Tip: Undefined class constant ' Mysql_attr_init_command '

Similar problems on the network:

Prompt cannot select MySQL, after the query said it is necessary to support PDO.

Yum then install Php-pdo and then extension=/usr/lib64/php/modules/pdo.so in php.ini, restarting the system, but Phpinfo () still has only SQLite's PDO support.

Some of the information on the network is said to install Pdo_mysql, but Yum can not find, check PDO also only php-pdo one, so supposedly only need to install PHP-PDO, but this is not very clear (many years have not touched the Linux), how to let the installation configuration PDO support MYSQL, Please instruct the master.

# yum Install Php-mysql PHP.ini added again: extension=/usr/lib64/php/modules/pdo_mysql.so after restarting the server or not.

Continue:./configure also added "--with-pdo-mysql--with-mysql-sock=/tmp/mysql.sock", which displays information about PDO as well.

The last line of make install is: Installing PDO headers: Does/usr/local/php5/include/php/ext/pdo/mean that it has been compiled?

There is still no support after restarting the server. There is no configuration for SQLite in PHP.ini, why is there a display in Phpinfo ()?

Solve:

Enter the source code directory of PHP, find the Ext extension directory inside the Pdo_mysql;

Enter the Pdo_mysql directory and execute the following command:

/usr/local/php/bin/phpize

./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-mysql=/usr/local/mysql

Make

Make install

The installation was successful at this time;

Then go to php.ini file, add extension=pdo.so extension=pdo_mysql.so;

Restart the server to see the pdo_mysql extension in the phpinfo.

Installing the Pdo_mysql extension on Linux CENTOS6

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.