sdfsdnfslk 发表于 2018-12-21 06:53:22

编译php时提示“Cannot find MySQL header files”的解决方法

  由于系统中被别人已经用rpm包安装过mysql了
  在编译php时参数如下:
  /configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-soap --with-gd --enable-sockets --enable-mbstring --disable-ipv6 --enable-exif --with-zlib --with-curl -with-curlwrappers --enable-calendar --with-gettext --enable-gd-native-ttf --enable-zend-multibyte --with-bz2--with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-libxml-dir--with-snmp


错误时候提示:
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore.
  
  这是由于安装mysql时没有安装mysql头文件,或者是路径指定不正确,php找不到mysql的头文件引起的错误提示。
  
解决方法。
1、 查看你的系统有没有安装mysql header
# find / -name mysql.h
如果有。请指定--with-mysql=/跟你的正常路径。
如果没有。请看下一步。
  2、# rpm -qa |grep mysql-devel //没有
  
3、 rpm -ivh -devel-4.1.12-1.i386.rpm

4、在重复上面的参数即可;
  下面是另外一个网友的方法:可以参考:

   php的配置文件中有一行--with-mysql=/usr。安装的时候提示:
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore.
  
这是由于安装mysql时没有安装mysql头文件,或者是路径指定不正确,php找不到mysql的头文件引起的错误提示。
  解决方法。
1. 查看你的系统有没有安装mysql header
   find / -name mysql.h
如果有。请指定--with-mysql=/跟你的正常路径。
如果没有。请看下一步。
  2.redhat安装
rpm -ivh MySQL-devel-4.1.12-1.i386.rpm
  3.debian安装
apt-get install libmysqlclient15-dev
  4.最后一步php的配置选项添加--with-mysql=/usr即可!



页: [1]
查看完整版本: 编译php时提示“Cannot find MySQL header files”的解决方法