2014-09-04 23:56:52
来 源
中存储网
MySQL
安装pdo_mysql,相应版本去http://pecl.php.net/package/pdo_mysql下载,开始安装。如果出现执行时报错如下:/software/pdo_mysql-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory。

根据开发需要现要安装pdo_mysql,相应版本去http://pecl.php.net/package/pdo_mysql 查看;
安装如下:

一、下载相应tgz包;
wget http://pecl.php.net/get/pdo_mysql-1.0.2.tgz

二、安装开始;
[root@cms-test software]# tar zxvf pdo_mysql-1.0.2.tgz
package2.xml
pdo_mysql-1.0.2/config.m4
pdo_mysql-1.0.2/CREDITS
pdo_mysql-1.0.2/mysql_driver.c
pdo_mysql-1.0.2/mysql_statement.c
pdo_mysql-1.0.2/pdo_mysql.c
pdo_mysql-1.0.2/php_pdo_mysql.h
pdo_mysql-1.0.2/php_pdo_mysql_int.h
pdo_mysql-1.0.2/php_pdo_mysql_sqlstate.h
package.xml
[root@icms-test software]# cd pdo_mysql-1.0.2
[root@cms-test pdo_mysql-1.0.2]# ls
config.m4 CREDITS mysql_driver.c mysql_statement.c pdo_mysql.c php_pdo_mysql.h php_pdo_mysql_int.h php_pdo_mysql_sqlstate.h
[root@cms-test pdo_mysql-1.0.2]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519

1、[root@cms-test pdo_mysql-1.0.2]#./configure
执行时报错如下;
configure: warning: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for MySQL support for PDO... yes, shared
checking for mysql_config... not found
configure: error: Cannot find MySQL header files under
解决办法:
cp /usr/local/mysql/bin/mysql_config /usr/bin

2、[root@cms-test pdo_mysql-1.0.2]#make
执行时报错如下:
/software/pdo_mysql-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory
In file included from /software/pdo_mysql-1.0.2/pdo_mysql.c:31:
/software/pdo_mysql-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before 'MYSQL'
/software/pdo_mysql-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before 'MYSQL_FIELD'
/software/pdo_mysql-1.0.2/php_pdo_mysql_int.h:53: error: expected specifier-qualifier-list before 'MYSQL_RES'
make: *** [pdo_mysql.lo] Error 1
解决办法:
yum install mysql-devel
[root@cms-test pdo_mysql-1.0.2]# make install

三、修改php.ini;
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension = "pdo_mysql.so"
OK,到此安装完成,可以查看phpinfo.php里找到对应的pdo_mysql。

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。