PHP编译安装中遇到的两个错误和解决方法
一、PHP configure: error: Cannot find ldap libraries in /usr/lib
今天在CentOS 64位下编译安装PHP5.4.8。结果在configure的时候提示
configure: error: Cannot find ldap libraries in /usr/lib
提示在/usr/lib 下找不到相关模块,这是因为64位的linux默认把以上文件都存在 /usr/lib64 文件夹下。
解决方法:
cp -frp /usr/lib64/libldap* /usr/lib/
重新configure即可
二、PDO_MYSQL make: *** [pdo_mysql.lo] Error 1
编译安装PDO_MYSQL拓展模块,总是提示:
In file included from /data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data0/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 /data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL'
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD'
/data0/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
这是因为这是因为在编译时需要 MySQL 的头的文件。而它按默认搜索找不到头文件的位置,所以才出现这个问题。通过软连接把MySQL头文件对应到/usr/local/include/下就好
比如你的MySQL安装文件位于/usr/local/mysql,那么就执行以下命令:
# ln -s /usr/local/mysql/include/* /usr/local/include/