Add PHP extension pdo_mysql step in CentOS

Source: Internet
Author: User

This article is about CentOS, for example, the Red Hat series of Linux methods should be so, the following detailed steps, here seriously despise what content?? Long ⑺ file brain leisurely 咴 Shadow said PDO compile installation article.

1, into the PHP package PDO extended Directory (note: Not the PHP installation directory)
If you have not yet downloaded:

1. download file wget 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
Enter the cd/root/php source file in the PHP source package/ext/pdo_mysql/pdo_mysql
Execute phpize command

The code is as follows Copy Code
/usr/local/php/bin/phpize

Note:/usr/local/php is my PHP installation directory

After the phpize command is executed, the Pdo_mysql directory appears configure

Perform configuration

The code is as follows Copy Code
./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-mysql=/usr/local/mysql/

Parameter description:

--WITH-PHP-CONFIG=/USR/LOCAL/PHP/BIN/PHP-CONFIG Specifies the configuration when installing PHP
--with-pdo-mysql=/usr/local/mysql/Specify the location of the MySQL database installation directory
Compiling the installation

The code is as follows Copy Code
Make && make install

After the compilation is complete, be aware of the presence of information similar to the following picture

The code is as follows Copy Code
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626

(Note: Different time period directory names may not be the same)

After the compile installation is complete, the generated pdo_mysql.so files are placed in this directory.

2. Modify php.ini File

Use VI to open your machine's php.ini file, adding a section of code "extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so" , loading the pdo_mysql.so file

3, view phpinfo ()

Restart the Apache server first. Use the Phpinfo () function to view the installation information for PHP, as shown in the following illustration to show that PDO extended installation was successful

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.