编译php时出现“configure: error: Cannot find MySQL header files under”

解决PHP编译缺少mysql.h问题
本文记录了作者在编译PHP过程中遇到缺少mysql.h头文件的问题,并详细描述了解决步骤:从下载MySQL Headers and libraries的rpm包到安装及最终配置PHP编译选项的过程。

提示没有找到头文件

于是[root@localhost /]#find /-name mysql.h

.........

find: mysql.h: 没有那个文件或目录
[root@localhost /]#

还是没有找到,于是去www.mysql.com下载Headers and libraries.

 

是一个rpm包。安装完后在/usr/inclue/mysql中就有了所需的头文件。

 

在次编译,终于提示成功。

[root@localhost php-5.2.9]# ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/include/mysql --enable-maintainer-zfs --enable-memory-limit --enable-zend-multibyte

-----------------------------------------

..................................

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

Notice: Following unknown configure options were used:

--enable-maintainer-zfs
--enable-memory-limit

Check './configure --help' for available options

[root@localhost php-5.2.9]#

当在 Linux 系统中遇到 `configure: error: cannot find required auxiliary files: compile` 错误,可以尝试以下方法来解决: 1. **重新生成辅助文件**:使用 `autoreconf` 命令可以重新生成 `configure` 脚本和相关的辅助文件。执行以下命令: ```bash autoreconf --install ``` 如果系统提示没有安装 `autoreconf`,可以使用包管理器进行安装。例如,在 Debian 或 Ubuntu 系统上: ```bash sudo apt-get install autoconf automake libtool ``` 在 CentOS 或 RHEL 系统上: ```bash sudo yum install autoconf automake libtool ``` 2. **手动下载和替换辅助文件**:可以从 GNU 官方镜像站点下载相应版本的 `autoconf` 和 `automake` 源码包,解压后将其中的辅助文件复制到当前项目目录。例如,下载 `autoconf` 2.69 版本: ```bash curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz tar -xzf autoconf-2.69.tar.gz cd autoconf-2.69 ``` 然后将需要的辅助文件复制到当前项目目录: ```bash cp compile /path/to/your/project ``` 3. **检查环境变量**:确保 `PATH` 环境变量包含了 `autoconf` 和 `automake` 的安装路径。可以使用以下命令查看 `PATH` 环境变量: ```bash echo $PATH ``` 如果没有包含相应的路径,可以临添加: ```bash export PATH=/path/to/autoconf/bin:/path/to/automake/bin:$PATH ``` 4. **更新 `autoconf` 和 `automake`**:确保系统中安装的 `autoconf` 和 `automake` 是最新版本。可以使用包管理器进行更新: ```bash # Debian 或 Ubuntu 系统 sudo apt-get update sudo apt-get upgrade autoconf automake # CentOS 或 RHEL 系统 sudo yum update autoconf automake ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值