How to compile and install PHP extension PDO in Linux (CentOS)

Source: Internet
Author: User
Tags php software
This article mainly introduces how to compile and install PHP extension PDO in Linux (CentOS), and describes the related skills and detailed steps involved in the installation of php pdo extension in Linux, for more information about how to compile and install PHP extension PDO in Linux (CentOS. We will share this with you for your reference. The details are as follows:

Here we take CentOS as an example. The Red Hat series Linux methods should all be like this. next we will explain the steps in detail, and here we will seriously despise some articles about PDO compilation and installation.

1. go to the pdo extension directory of the PHP software package (note: it is not the PHP installation directory)

[root@gamejzy /]# cd /tmp/lamp/php-5.3.19/ext/pdo_mysql/

Note: My php package is under/tmp/lamp/php-5.3.19

The code is as follows:

[Root @ gamejzy pdo_mysql] #. /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 during PHP installation
-- With-pdo-mysql =/usr/local/mysql/specify the installation directory of the MySQL database

Compile and install

[root@gamejzy pdo_mysql]# make && make install

After the compilation is complete, check whether the information similar to that shown in slices appears.

Note that the compilation and installation are successful.Red LineCircled Directory (note: The Directory names may be different in different time periods ).

After compilation and installation are complete, the generated pdo_mysql.so file is placed in this directory.

2. modify the php. ini file

Use vi to open the php. ini file on your machine, add a piece of code "extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so", load the pdo_mysql.so file

The effect is as follows:

Save and exit editing!

3. View phpinfo ()

Restart the Apache server. Use the phpinfo () function to view the php installation information, as shown in. the PDO extension is successfully installed.

End now!

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.