在客户现场碰到几个问题

使用源码编译安装php在64位的centos 5.7上,执行configure是报错,
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-trace-vars --with-mysql=/usr/include/mysql --with-mysqli=/usr/lib64/mysql/mysql_config --with-config-file-path=/usr/local/php --with-libxml-dir --with-dom --with-iconv -with-gd --with-jpeg=/usr/lib --with-openssl --enable-ftp --with-curl=/usr/bin
下面是错误信息:
。。。。。。
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
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.

config.log文件的具体提示:
configure:60284: checking for mysql_error in -lmysqlclient
configure:60303: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib -Wl,-rpath,/usr/kerberos/lib64 -L/usr/kerberos/lib64 -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient -lz -lpng -lz -lcurl -lrt -lm -ldl -lnsl -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz 1>&5
/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 60292 "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_error();

int main() {
mysql_error()
; return 0; }

使 用命令查找libmysqlclient文件,发现是在lib64目录内的有libmysqlclient.so.15.0.0,但是在lib下并没有这 个文件,于是做了软连接过去,再执行configure错误不见了。,这个问题可能是PHP默认是去的 /usr/lib/搜索,没有找到。
解决办法有3个:
1,cp /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so

2,ln -s /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so

3,在编译php时加入–with-libdir=lib64

你可能感兴趣的:(PHP,mysql)