假設php目錄為/usr/local/php
mysql目錄為/usr/local/mysql
1. 進入PHP源碼包ext/pdo目錄
cd ext/pdo
2. 執行/usr/local/php/bin/phpize[假設PHP的安裝目錄為/usr/local/php]
/usr/local/php/bin/phpize
3. 配置擴充pdo
./configure --with-php-config=/usr/local/php/bin/php-config --enable-pdo=shared
4. 編譯 && 安裝pdo
make && make install
成功則出現
Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
Installing header files: /usr/local/php//include/php/
Installing PDO headers: /usr/local/php//include/php/ext/pdo/
說明在/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目錄下產生了pdo.so檔案
5. 在PHP源碼包中進入pdo_mysql
cd ext/pdo_mysql
6. /usr/local/php/bin/phpize
/usr/local/php/bin/phpize
7. 配置pdo_mysql[假設Mysql的安裝目錄為/usr/local/mysql]
1
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
8. 編譯 安裝pdo_mysql
make && make install
成功則出現
Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
說明的/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目錄下產生了pdo_mysql.so檔案
9. 在php設定檔中加上
extension="/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so";
extension="/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo.so";
10. 重啟相關服務
/etc/init.d/php-fpm restart