<checking for mysql_config not found>

Linux.應用發表於2015-01-09

php 5.3.29編譯安裝排錯:

 

 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr/loca/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session  --with-curl --enable-ctype

 

錯誤:

 

    1. checking for mysql_config... not found
    2. configureerror: Unable to find your mysql installation

 

我找了很多方法,但都沒解決:

1、這種很接近,但不明確,還是讓人蒙圈。

這個由於在編譯的時候指定了 ‘ --with-pdo-mysql ’ 選項,但它並沒有找到 mysql 的安裝目錄,因此只用指定 mysql 的安裝目錄就可以了  '--with-pdo-mysql=/usr/local/mysql'

2、這種完全不沾邊,錯誤的。

1)sudo ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
將mysql_confi從你的安裝目錄連結到/usr/local/bin目錄下,這樣就可以在任意目錄下訪問了(也可以放到/usr/bin)
      2)編輯原始碼資料夾的site.cfg檔案,去掉#mysql_config = /usr/local/bin/mysql_config前的註釋#,修改後面的路徑為你的mysql_config真正的目錄就可以了。(如果不知道mysql_config在哪裡,執行命令:whereis mysql_config)

3、和第二種一樣的想法,也是錯誤的。

 

執行

 

ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

 

將mysql_config連結到/usr/local/bin目錄下

4、我感覺有點可能。

yum install mysl   mysql-devel 

5、有一篇說揹人的部落格寫的都是錯的,安裝這2個包就可以解決,他自己試過,但是沒解決我的問題。

 

MySQL-shared-compat-5.5.40-1.el6.x86_64.rpm

MySQL-shared-5.5.40-1.el6.x86_64.rpm

mysql-embedded-devel-5.1.73-3.el6_5.x86_64

 

下面來說下我的最簡單,直接有效的辦法:

 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session  --with-curl --enable-ctype

 

報錯是因為mysql安裝這個外掛時,按指定的路徑找不到。我們幹嘛要去幹預呢,直接為空,讓它自己搜尋找去,這樣不就好了。

相關文章