【解决方法】phpize 编译安装 php 扩展时出现Cannot find autoconf

本文介绍了解决在安装PHP扩展时遇到的phpize错误的方法。主要原因是缺少autoconf工具,通过在OSX系统上使用Homebrew安装autoconf,或在CentOS系统上使用yum命令安装autoconf,可以成功生成configure文件,进而顺利完成PHP扩展的安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

已知,编译安装 php 扩展的时候,需要先执行 phpize 来 生成 configure 文件。

但是,最近在安装扩展的时候出现了如下错误:

$ /path/to/php/php5.6.40/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

问题分析

上面给的解释已经挺清楚的了:缺少 autoconf。那就安装 autoconf 好了。

解决方法

OSX

执行如下指令:

$ brew install autoconf

出现类似以下结果即为安装完成:

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
rust

==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.mojave.bottle
==> Downloading from https://akamai.bintray.com/97/9724736d34773b6e41e2434ffa28f
######################################################################## 100.0%
==> Pouring autoconf-2.69.mojave.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/autoconf
==> Summary
🍺  /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB

CentOS

执行如下指令:

# yum install autoconf

再次执行 phpize,没有问题:

$ /path/to/php/php5.6.40/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值