编译安装pdo_mysql提示pdo_mysql.lo出错的解决办法
时间:2016-05-28 19:15 来源:linux.it.net.cn 作者:IT
环境是在PHP5.4下,configure参数如下:
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar zxf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make这一步就报错了,错误提示如下:
In file included from /root/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory
In file included from /root/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL’
/root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD’
/root/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
解决办法:
这是因为在编译时需要mysql的头文件,而默认搜索路径找不到头文件的位置,所以才出现这个问题,所以要将 /usr/local/mysql/include/mysql/ 目录下的mysql头文件链接到 /usr/local/include/ 的目录下:
ln -s /usr/local/mysql/include/mysql/* /usr/local/include/
接下来再make和make install,pdo_mysql模块就加进去了。
(责任编辑:IT)
环境是在PHP5.4下,configure参数如下:
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz tar zxf PDO_MYSQL-1.0.2.tgz cd PDO_MYSQL-1.0.2 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql make make这一步就报错了,错误提示如下: In file included from /root/PDO_MYSQL-1.0.2/pdo_mysql.c:31: /root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory In file included from /root/PDO_MYSQL-1.0.2/pdo_mysql.c:31: /root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL’ /root/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD’ /root/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
解决办法: ln -s /usr/local/mysql/include/mysql/* /usr/local/include/ 接下来再make和make install,pdo_mysql模块就加进去了。 (责任编辑:IT) |