`
james23dier
  • 浏览: 530124 次
  • 性别: 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.
分享到:
评论

相关推荐

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

    在Linux系统上编译PHP时,可能会遇到一个常见的错误,即"configure error Cannot find libmysqlclient under /usr"。这个错误通常发生在尝试构建PHP并将其与MySQL数据库集成时,因为配置脚本无法找到必要的MySQL...

    安装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 ...

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

    在这个阶段,你需要运行`./configure`脚本来配置编译选项。在标题中提到的配置中,`--prefix`用于设置Nginx的安装路径,默认为`/usr/local/nginx`。你可以根据需要添加其他配置参数。例如: ```bash ./configure...

    CentOS下编译php时的一些典型错误及解决办法.

    11. configure: error: Cannot find MySQL header files under /usr.Note that the MySQL client library is not bundled anymore! 解决方法: yum install mysql-devel 此错误是由于缺少 mysql-devel 库文件所...

    解决usrlib64libstdc++.so.6和lib64libc.so.6版本过低问题

    [root@haughty glibc-2.14] ./configure --prefix=/usr/glibc-2.14 ``` #### 四、注意事项 1. **备份原库文件**:在替换之前最好备份原有的库文件,以免出现问题后无法恢复。 2. **环境变量检查**:确保修改后的...

    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下安装配置 Apache2.2.x+MySql5.x+PHP5.x 详解

    * 配置 Apache:`./configure --prefix=/home/work/usr/local/apache2 --enable-mods-shared=all` * 编译 Apache:`make` * 安装 Apache:`make install` * 启动 Apache:`bin/apachectl start` 知识点三:安装 ...

    linux下php+mysql+apatch搭建web服务器

    知识点 5: GD 库安装和配置 1. 下载 GD 软件包:gd-2.0.33.tar.gz 2. 解压缩软件包:tar xfz gd-2.0.33.tar.gz 3. 配置 GD:./configure --help 4. 设置 GD 的安装目录:/usr/local/gd 知识点 6: ZendOptimizer ...

    PHP编译configure时常见错误的总结

    3. **错误:configure: error: Cannot find OpenSSL’s** 解决方案:在CentOS上,需安装`openssl-devel`,命令为`yum -y install openssl-devel`。 4. **错误:configure: error: libjpeg.(a|so) not found** ...

    Linphone编译错误及解决方法

    7. configure: error: Could not find libavcodec (from ffmpeg) headers and library. This is mandatory for video support 错误原因:缺少libavcodec头文件和库文件。 解决方法:sudo apt-get install ...

    qt环境安装

    在`make`阶段,可能会遇到“/usr/bin/ld: cannot find -lXrender collect2: ld returned 1 exit status”的错误,这意味着缺少`libxrender-dev`库。同样,通过运行`apt-get install libxrender-dev`来安装这个库,...

    CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    ### CentOS 7.0 编译安装 Nginx1.6.0 + MySQL5.6.19 + PHP5.5.14 #### 一、环境准备与配置 在开始部署 LNMP(Linux+Nginx+MySQL+PHP)... ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/...

    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-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-5.6.40的编译环境.rar

    ./configure --with-config-file-path=/usr/local/etc/php --with-config-file-scan-dir=/usr/local/etc/php/conf.d --with-include-dir=/usr/include ``` 这里的`/usr/include`是大多数系统默认的include目录,...

    redis-5.0.4.tar.gz下载及redis安装过程

    5: 可选步骤: make test 测试编译情况 (可能出现: need tcl >8.4这种情况, yum -y install tcl ) 6: 安装到指定的目录,比如 /usr/local/redis make PREFIX=/usr/local/redis install 注: PREFIX要大写 7: ...

    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

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

    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

Global site tag (gtag.js) - Google Analytics