php with-zlib,rhel 5 x86_64下编译php出现错误(Try adding --with-zlib-)解决

config.log中同时有/usr/bin/ld: cannot find -lmysqlclient错误

系统版本如下

[root@opencms php-5.2.6]# uname -a

Linux opencms 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

安装php-5.2.6的时候,编译选项如下:

[root@opencms php-5.2.6]#./configure "--prefix=/usr/local/php" "--with-apxs2=/usr/local/apache/bin/apxs" "--with-config-file-path=/usr/local/php/etc" "--with-mysql"

报以下错误

configure: error: Try adding --with-zlib-dir=

. Please check config.log for more information.查看config.log,发现里面有下面提示:

configure:60044: gcc -o conftest -I/usr/include -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib conftest.c -lmysqlclient -lz -l resolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm 1>&5 /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status configure: failed program was: #line 60033 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mysql_errno(); int main() { mysql_errno() ; return 0; }由于本系统时x86_64的,在/usr下有lib和lib64两个目录,现在提示是在/usr/lib/mysql下找mysql*文件,感觉不太对劲,于是

[root@opencms php-5.2.6]# cd /usr/lib

[root@opencms lib]# mv mysql/ mysql.bak/

[root@opencms lib]# ln -s /usr/lib64/mysql /usr/lib/mysql

重新编译php,一些正常。

不知道为什么会在两个目录下都出现mysql目录,用以下命令查看的时候发现了问题所在

[root@opencms lib]# rpm -qa | grep mysql

mysql-5.0.45-7.el5

libdbi-dbd-mysql-0.8.1a-1.2.2

mysql-devel-5.0.45-7.el5

mysql-5.0.45-7.el5

mysql-server-5.0.45-7.el5

mysql-connector-odbc-3.51.12-2.2

原来是同一个package出现了两次,版本也都是一样的,我估计是安装系统的人把32位和64位的mysql都安装了一遍。。。

于是执行卸载

[root@opencms lib]# rpm -e mysql

error: "mysql" specifies multiple packages

卸载不掉

通过rpm --help发现–allmatches应该可以解决这个问题:

–allmatches

Remove all versions of the package which match PACKAGE_NAME. Normally an error is issued if PACKAGE_NAME matches

multiple packages.

rpm -e --allmatches mysql-5.0.45-7.el5

卸载的时候又出现包依赖,最后使用

rpm -e -nodeps --allmatches mysql-5.0.45-7.el5

全部卸载完毕后重新安装x86_64的mysql,就只在/usr/lib64下出现mysql目录了。

可这时问题又出现了,报以下错误:

configure: error: Cannot find libmysqlclient under /usr.

Note that the MySQL client library is not bundled anymore!

应该还是php编译的时候默认去找/usr/lib/mysql这个目录,重复刚才的步骤:

[root@opencms lib]# ln -s /usr/lib64/mysql /usr/lib/mysql

重新编译php,问题解决!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值