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