好久没有编译安装过php了,为了玩nginx.没法子,编译一次来测试.我加的编译的参数是:
# ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-gd --enable-gd-native-ttf --with-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-debug --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mcrypt
没想到老是出下面的错
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.
google很久,都讲下面的答案,晕,这种也叫答案,那我不是还要重新编译一次mysql.这个php就很麻烦了.这个一定不对.
网查找说:安装PHP的时候没有指定一下mysql的安装目录。但是我已经指定了,所以这个说法是错误的,其实主要原因是 mysql-level没有装,也就是mysql的版本不对,应该换
mysql-max-5.0.21版本(包含所有mysql相关内容的软件包)
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 59854 "configure"
#include "confdefs.h"
在看看config.log提示的错....哦.原来是版本有问题.想起我的系统都是X86的,lib都是64位的.所以解决方法很容易.
这个libmysqlclient.a library 是在 /usr/lib64/mysql, 不是在 /usr/lib/mysql.
所以可以做下面的方法来解决
#export LDFLAGS=-L/usr/lib64/mysql
OR 请将Makefile里面的 -L/usr/lib/mysql 改为 -L/usr/lib64/mysql