ITPub博客

首页 > Linux操作系统 > Linux操作系统 > PHP编译报错configure: error: Cannot find libmysqlclient under /usr.

PHP编译报错configure: error: Cannot find libmysqlclient under /usr.

原创 Linux操作系统 作者:goolen 时间:2014-07-31 09:37:11 0 删除 编辑
今天编译PHP的时候遇到了几个错误,记录一下
第一次编译的时候报错如下:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

报这个错是因为没有安装libmcrypt这个包,下载地址如下:
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz

安装:
[root@localhost app]# tar zxfv libmcrypt-2.5.7.tar.gz
[root@localhost app]# cd libmcrypt-2.5.7
[root@localhost app]# ./configure
[root@localhost app]# make ; make install

重新编译php
[root@localhost app]# cd php-5.3.28
[root@localhost php-5.3.28]# ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/bin/mysql_config --with-mysql-sock=/var/lib/mysql/mysql.sock --with-gd --with-iconv  --with-zlib  --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --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-mcrypt --with-curl

第二次编译报错如下:
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

这个错误时因为在64位的linux系统中,libmysqlclient 默认安装到了 /usr/lib64/mysql/ 目录下,但是php编译时,要去/usr/lib目录下查找
解决办法:在/usr/lib目录下创建一个软连接
[root@localhost php-5.3.28]# ls /usr/lib64/mysql/libmysqlclient*
/usr/lib64/mysql/libmysqlclient_r.so     /usr/lib64/mysql/libmysqlclient_r.so.16.0.0  /usr/lib64/mysql/libmysqlclient.so.16
/usr/lib64/mysql/libmysqlclient_r.so.16  /usr/lib64/mysql/libmysqlclient.so           /usr/lib64/mysql/libmysqlclient.so.16.0.0

[root@localhost php-5.3.28]# ln -s /usr/lib64/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so

最后编译成功:
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23249684/viewspace-1242858/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-10-20

  • 博文量
    121
  • 访问量
    732039