xdebug 在 phpize 时报错 Cannot find autoconf

Php 2020-06-10 阅读 42 评论 0

问题描述

为调试 php-7.4.6,下载了 xdebug,运行以下命令,最后报错了。

$ wget http://xdebug.org/files/xdebug-2.9.6.tgz
$ tar xf xdebug-2.9.6.tgz
$ cd xdebug-2.9.6
$ /opt/php-7.4.6/bin/phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决方法

1. 安装 autoconf

  • Mac OS
brew install autoconf
  • Ubuntu/Debian

在网站 https://pkgs.org/search/?q=autoconf 下载与操作系统相应的 autoconf 并安装,或者直接运行 apt-get 命令。

sudo apt-get install autoconf
  • RHEL/CentOS

在网站 https://pkgs.org/search/?q=autoconf 下载与操作系统相应的 autoconf 并安装,或者直接运行 yum 命令。

sudo yum install autoconf

2. 安装 xdebug

安装好 autoconf 之后,继续运行安装 xdebug 命令。

$ /opt/php-7.4.6/bin/phpize
$ ./configure --prefix=/opt/php-7.4.6 --with-php-config=/opt/php-7.4.6/bin/php-config
$ make
$ sudo make install

最后在 php.ini 文件中,添加

extension=xdebug.so
最后更新 2020-06-10