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 libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

The issue was that I the MySQL server version was 64-bit and the php compile script was looking for 32-bit libraries. To see if your MySQL server is 64-bit or 32-bit check the version by issuing the below command and looking for a response also shown below.

 

MySQL Version:
[root@server php-5.2.8]# mysql –version
mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0

To resolve the issue add the below configuration options to your PHP configure script.

Options to Add:
–with-mysql=/usr/bin/ –with-libdir=lib64

So my PHP configure script after adding these options now looked like the below which resolve the compile error.

PHP Configure Script:
./configure –prefix=/var/lsws/lsphp5 –with-litespeed –with-mysqli –with-mcrypt –with-mysql=/usr/bin/ –with-libdir=lib64 –with-zlib –with-gd –enable-shmop
–enable-track-vars –enable-sockets –enable-sysvsem –enable-sysvshm –enable-magic-quotes –enable-mbstring –with-iconv

Share: Click an icon below to share using one of the social networking sites below. These icons link to social bookmarking sites where readers can share and discover new web pages.

你可能感兴趣的:(linux,mysql,PHP,centos,Social)