以下為google的結果:
方案一:
轉載鏈接:http://www.php-oa.com/2008/03/28/php-make.html
好久沒有編譯安裝過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
方案二:
轉載鏈接:http://blog.csdn.net/wlx3351/article/details/5938964
AS5 X64下?php-5.3.3編譯時出現configure: error: mysql configure failed.
是由于64位引起的
處理辦法:
ln -s /usr/lib64/mysql/ /usr/local/lib/mysql
ln -s /usr/include/mysql/ /usr/local/include/mysql
?
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib=/usr/local/zlib --with-gd=/usr/local/gd -with-png-dir=/usr/local --with-jpeg-dir=/usr --with-freetype-dir=/usr/local --enable-mbstring --with-mysql=/usr/local --with-xml
?
請確認是否安裝
mysql-5.0.22-2.2.el5_1.1.x86_64.rpm?? 也可以用mysql-5.0.22-2.1.x86_64.rpm
mysql-devel-5.0.22-2.2.el5_1.1.x86_64.rpm?? 也可以用 mysql-devel-5.0.22-2.1.x86_64.rpm
查看CPU和系統位數:http://blog.csdn.net/eiyaa/article/details/4184353
總結:上面的方法不一定是可以解決你的問題,具體要看php編譯目錄中的config.log中提示什么錯誤。
像我的提示:con't find -ltdl libraries ...
解決方法:apt-get install libltdl-dev