編譯安裝PHP出現configure: error: mysql configure failed. Plea

本文出自:phpoa


好久沒有編譯安裝過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


 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *