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!