日期:2014-05-16  浏览次数:20822 次

linux安装php5出现错误:configure: error: Cannot find libmysqlclient under /usr.

最近在centOs上安装apache+mysql+php5.1.6时,出现如下问题:configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

纠缠了我一天的时间,最后实在不行。还是百度。

得到一篇博文指导,成功解决了问题:原文网址:http://apps.hi.baidu.com/share/detail/15155324

内容如下:

php:
http://www.rpmfind.net/linux/rpm2html/search.php?query=php (rpm)
http://cn.php.net/get/php-5.3.0.tar.gz/from/a/mirror
./configure --help | grep mysql
tar -zxvf php-5.3.0.tar.gz
mv php-5.3.0.tar.gz php
cd php
rpm -Uvh MySQL-devel-standard-5.0.27-0.rhel4.x86_64.rpm
cp /usr/lib64/mysql/* /usr/lib/mysql/ #解决
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql --with-zlib-dir=/usr/local
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql=/usr/lib64/mysql --with-zlib-dir=/usr/local (不正确)
make
make install

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql=/usr/lib64/mysql --with-zlib-dir=/usr/local (ok)

今天在64位centos5.2系统上编译PHP526出错,mysql是使用的RPM方式安装的,PHP编译代码:

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql -enable-track-vars --enable-fastcgi --disable-debug --enable-url-includes --enable-sockets --enable-force-cgi-redirect --enable-calendar --with-config-file-path=/etc --with-openssl --with-zlib --with-gettext --enable-magic-quotes --enable-ftp --with-ttf --with-gdbm --with-gettext --with-iconv --with-xml --enable-mbstring=all

出现一下错误:

checking whether time.h and sys/time.h may both be included... yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for 8-bit clean memcmp... yes
checking for mcrypt support... no
checking for mhash support... no
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
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!

通过查找libmysqlclient,发现是在/usr/lib64/mysql/目录内的libmysqlclient.so.15.0.0做的软连接,PHP默认是去的 /usr/lib/搜索,所以没有找到.找到问题了就好解决了.

解决办法就是:

  1. cp -rp /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so
  2. centos?? : --with-mysql=/usr/lib64/mysql (香巴拉) 或者cp /usr/lib64/mysql/* /usr/lib/mysql/

?

?

configure: error: Cannot find libmysqlclient under /usr

Posted by alex in Errors

I received the below error when compiling PHP to work as an external application with the Litespeed API. When you do compile this it’s called the PHP LSAPI module which is then used by Litespeed to process PHP.

PHP Build Error:
configure: error: Cannot find libmysqlclien