PHP

php添加pdo_mysql模块报错

进入到php的ext/pdo_mysql目录,操作如下:
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
报错如下:
In file included from /data1/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory
In file included from /data1/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL’
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD’
/data1/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
请问,这个问题如何解决?
已邀请:

采菊篱下 - 无分享不快乐 助力技术开源分享 运维一枚

赞同来自: Ansible

这是因为在编译时需要mysql的头的文件,而它按默认搜索找不到头文件的位置,所以才出现这个问题.所以要将 /usr/local/mysql/include/ 目录下的mysql头文件链接到 /usr/local/include/ 的目录下:
ln -s /usr/local/mysql/include/mysql /usr/local/include/
然后再make和make install,pdo_mysql模块加进去了.

要回复问题请先登录注册