PHP編譯時報錯error: mysql configure failed.以及/usr/bin/ld: cannot find -lmysqlclient

PHP編譯過程中報錯:

error: mysql configure failed. Please check config.log for more information.

不停百度,看日誌,總算解決了。

日誌的錯誤提示/usr/bin/ld: cannot find -lmysqlclient

#/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.so when searching for -lmysqlclient
#/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.a when searching for -lmysqlclient
#/usr/bin/ld: cannot find -lmysqlclient

先去了/usr/local/mysql/lib/libmysqlclient.so沒找到lmysqlclient。

解決辦法:

# yum -y install MySQL-devel

還不夠,這只是爲了在/usr/lib64下產生一個mysql文件夾。然後做一個軟鏈接:

# cd /usr/local/mysql
# mv lib lib.bak
# ln -s /usr/lib64/mysql /usr/local/mysql/lib

或者把原有的lib備份,(/usr/local/mysql/lib),然後將/usr/lib64/mysql複製到替換它。搞定

如果還沒有解決:

mysql相關rpm的64位版除了server之外都裝了一遍

也是一個不錯的辦法哦!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章