`
james23dier
  • 浏览: 525485 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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.
分享到:
评论

相关推荐

    安装lamp报错信息及解决方法

    httpd: Syntax error on line 57 of /etc/httpd/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: undefined symbol: xmlTextReaderSetup ...

    编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法

    ./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 --...

    nginx安装教程

    sudo ./configure --sbin-path=/usr/local/nginx/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid \ --with-http_ssl_module \ --with-pcre=/usr/local/src/pcre-8.41 \ ...

    Linux 下 Nginx的安装:(解压,进入目录里面执行,./configure –-> make -> sudo make install)

    NULL 博文链接:https://jackroomage.iteye.com/blog/1687401

    银河麒麟V10系统+飞腾CPU交叉编译OpenCV

    ./configure make –j8 make install 执行上述过程中make时可能会报错,错误结果如下 ./include/nasmlib.h:194:1: error: ‘pure’ attribute on function returning ‘void’ [-Werror=attributes] 194 | void pure...

    PHP 仿陌陌直播

    ./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module make && make install 本次默认安装目录为:/root, add-module为下载的nginx-rtmp-module文件路径。 安装时候...

    PHP编译安装中遇到的两个错误和解决方法

    一、PHP configure: error: Cannot find ldap libraries in /usr/lib 今天在CentOS 64位下编译安装PHP5.4.8。结果在configure的时候提示 configure: error: Cannot find ldap libraries in /usr/lib 提示在/usr/lib ...

    opencv移植到arm, 包含cmake包

    ../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc' ../../lib/libopencv_core.so: undefined reference to `...

    apr-1.7.0.zip

    1、httpd-2.4.41.tar 2、apr-1.7.0.tar 报错: rm: cannot remove `libtoolT': No such file or directory ..../configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr=/usr/local/apr

    httpd-2.4.41.rar

    源码编译:亲测有效! 1、httpd-2.4.41.tar 2、apr-1.7.0.tar 报错: rm: cannot remove `libtoolT': No such file ..../configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr=/usr/local/apr

    apr-util-1.6.1.zip

    1、httpd-2.4.41.tar 2、apr-1.7.0.tar 报错: rm: cannot remove `libtoolT': No such file or directory ..../configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr=/usr/local/apr

    lidmodbus3.14(解决configure.js错误)

    libmodbus最新版,解决了原资源中configure.js运行错误

    php-5.6.29.tar.gz

    编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --...

    PHP 7的 librdkafka-1.2.0.tar.gz 扩展安装

    tar -zxvf php-rdkafka-3.1.2.tar.gz && cd /root/php-rdkafka-3.1.2 && /usr/local/php7/bin/phpize && ./configure --with-php-config=/usr/local/php7/bin/php-config && make all -j 5 && make install

    tensorflow安装遇到的问题

    使用国内源安装tensorflow: pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade tensorflow-gpu==1.5.0 pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade keras==2.1.6 国内镜像...

    arm-linux-gcc-4.3.2(交叉编译器)

    ding specs from /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/specs Configured with: /opt/crosstool/crosstool-0.28/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure --target=arm-linux --...

    php-rdkafka-3.1.2.tar.gz

    tar -zxvf php-rdkafka-3.1.2.tar.gz && cd /root/php-rdkafka-3.1.2 && /usr/local/php7/bin/phpize && ./configure --with-php-config=/usr/local/php7/bin/php-config && make all -j 5 && make install

    CentOS7.2.1511 gcc4.8.5 通过编译的 tfs2.2.16

    [root@2f60c4bcddfa tfs_release-2.2.16]# ./configure --prefix=/usr/local/ configure ok make 问题 : serialization.h:575:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=...

    python linux离线安装.rar

    ./configure --prefix="/usr/local/Python-3.7.3" make && make install #删除原来的 rm -f /usr/bin/python rm -f /usr/bin/pip rm -f /usr/bin/virtualenv #创建新连接 ln -s /usr/local/Python-3.7.3/bin/...

Global site tag (gtag.js) - Google Analytics