configure: error: wrong mysql library version or lib not found

在對已有的PHP增長mysqli 擴展時,php

 ./configure --with-php-config=/usr/local/bin/php-config --with-mysqli=/usr/bin/mysql_configmysql

遇到以下錯誤:sql

configure: error: wrong mysql library version or lib not foundapache

解決方法,若是以前是以yum install mysql的話,可能yum install mysql-devel,若是是經過源代碼安裝的話,把mysql_config路徑改一下即好。.net

 ./configure --with-php-config=/usr/local/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config。debug

此外,php 增長mysqli的方法以下:rest

一、進入PHP源代碼目錄:# cd /tmp/php-5.2.14/
二、再進入要添加的mysqli擴展源碼目錄:# cd ext/mysqli/
二、調用已經編譯好的php裏面的phpize:# /usr/local/php/bin/phpize
三、而後configure:# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
四、make && make install
五、編譯以後,自動把mysqli.so放到了默認的php擴展目錄下,個人爲 /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/get

(phpinfo可查看或者執行命令/usr/local/php/bin/php-config --extension-dir )源碼

再修改php.ini 找到extension_dir 默認路徑爲 extension_dir="./"it

在下面添加extension = "mysqli.so" 保存便可

extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

extension = "mysqli.so"

六、重啓apache:# service httpd restart

 

若是遇到  WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers

下載並編譯安裝一下re2c即好。

相關文章
相關標籤/搜索