问题见:http://www.thinkphp.cn/topic/28755.html
解决方案如下:
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文件
6.在php配置文件中加上
extension=”/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo.so”
7.在PHP源码包中进入pdo_mysql
cd ext/pdo_mysql
8.执行/usr/local/php/bin/phpize
9.配置pdo_mysql[假设Mysql的安装目录为/usr/local/mysql]
./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysql
10.编译pdo_mysql 安装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文件
12.在php配置文件中加上
extension=”/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so”
重启php和(nginx或Apache)即可!
错误解决:
make: *** [pdo_mysql.lo] Error 1
这是因为这是因为在编译时需要 MySQL 的头的文件。而它按默认搜索找不到头文件的位置,所以才出现这个问题。通过软连接把MySQL头文件对应到/usr/local/include/下就好
比如你的MySQL安装文件位于/usr/local/mysql,那么就执行以下命令:
# ln -s /usr/local/mysql/include/* /usr/local/include/
安装php扩展mysqli
1: cd 到mysqli文件目录下,执行 /usr/local/php/bin/phpize
2: ./configure –with-php-config=/usr/local/php/bin/php-config –with-mysqli=/usr/local/mysql/bin/mysql_config
3: make
4: make test
5: make install
6:修改php.ini
加入或者去掉注释 extension = “mysqli.so” (如果extension_dir 不对,此处需要写全路径)
然后重启web服务器