溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

編譯PHP報(bào)錯(cuò)configure error Cannot find libmysqlclient under usr如何解決

發(fā)布時(shí)間:2021-06-30 17:41:03 來(lái)源:億速云 閱讀:153 作者:chen 欄目:開(kāi)發(fā)技術(shù)

這篇文章主要講解了“編譯PHP報(bào)錯(cuò)configure error Cannot find libmysqlclient under usr如何解決”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“編譯PHP報(bào)錯(cuò)configure error Cannot find libmysqlclient under usr如何解決”吧!

今天在64位Red Hat Enterprise Linux AS release 4 .7上編譯PHP5.2.6出錯(cuò),mysql是使用的RPM方式安裝的,PHP編譯代碼如下:

./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache/bin/apxs --with-openssl --with-curl --enable-xml --with-mcrypt --with-ttf --enable-magic-quotes --enable-fastcgi --enable-mbstring --with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-sysvsem出現(xiàn)以下錯(cuò)誤:checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

通過(guò)查找libmysqlclient,發(fā)現(xiàn)是在/usr/lib64/mysql/目錄內(nèi)的libmysqlclient.so.16.0.0做的軟連接,PHP默認(rèn)是去的 /usr/lib/搜索,所以沒(méi)有找到.找到問(wèn)題了就好解決了.

類(lèi)似的問(wèn)題還有:

/usr/lib/libjpeg.so -> /usr/lib64/libjpeg.so

解決方法:

1.

cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so

2.

/usr/lib64/libmysqlclient.so -> libmysqlclient.so.16.0.0/usr/lib/libmysqlclient.so -> /usr/lib64/libmysqlclient.so
checking whether to enable embedded MySQLi support… no
checking for mysql_set_server_option in -lmysqlclient… no
configure: error: wrong mysql library version or lib not found. Check config.log for more information

經(jīng)過(guò)測(cè)試后, 發(fā)現(xiàn)如下解決方案:

(php-xxxxx為php文件名, 代表路徑)

# cd /usr/local/src/php-xxxxx/ext/mysqli
# yum -y install mysql-devel
# /phpize
# ./configure –with-php-config= /php-config –enable-embedded-mysqli=shared –enable-shared
# make
# make install

這時(shí)屏幕會(huì)打印mysqli.so生成的路徑, 在php.ini里加載就好啦

/usr/bin/ld: cannot find -lmysqlclient

感謝各位的閱讀,以上就是“編譯PHP報(bào)錯(cuò)configure error Cannot find libmysqlclient under usr如何解決”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)編譯PHP報(bào)錯(cuò)configure error Cannot find libmysqlclient under usr如何解決這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

php
AI