pdo扩展模是有蛮多了,如pdo_mysql也是pdo模块中的一个了,下文我们就以安装pdo_mysql为示例帮助大家介绍一下安装步骤吧,其它的pdo扩展模块安装步骤也可以一样.
假设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
成功则出现:
- Installingsharedextensions:/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
- Installingheaderfiles:/usr/local/php//include/php/
- InstallingPDOheaders:/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]
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
8.编译 安装pdo_mysql
make && make install
成功则出现:
- Installingsharedextensions:/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";//phpfensi.com
10.重启相关服务
/etc/init.d/php-fpm restart