【解決方法】phpize 編譯安裝 php 擴展時出現Cannot find autoconf

背景

已知,編譯安裝 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章