我最近在我的 Ubuntu 20.04 服务器上安装了 PHP 8.0,我正在尝试让 Xdebug 使用它。我已经按照https://xdebug.org/wizard的说明安装了它:
Installation Wizard
Summary
Xdebug installed: no
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 8.0.0
Zend API nr: 420200930
PHP API nr: 20200930
Debug Build: no
Thread Safe Build: no
OPcache Loaded: yes
Configuration File Path: /etc/php/8.0/cli
Configuration File: /etc/php/8.0/cli/php.ini
Extensions directory: /usr/lib/php/20200930
Instructions
Download xdebug-3.0.2.tgz
Install the pre-requisites for compiling PHP extensions.
On your Ubuntu system, install them with: apt-get install php-dev autoconf automake
Unpack the downloaded file with tar -xvzf xdebug-3.0.2.tgz
Run: cd xdebug-3.0.2
Run: phpize (See the FAQ if you don't have phpize).
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20200930
Zend Extension Api No: 420200930
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/lib/php/20200930
Edit /etc/php/8.0/cli/php.ini and add the line
zend_extension = /usr/lib/php/20200930/xdebug.so
Make sure that zend_extension = /usr/lib/php/20200930/xdebug.so is below the line for OPcache.
Please also update php.ini files in adjacent directories, as your system seems to be configured with a separate php.ini file for the web server and command line.
但是我在做的时候得到这个错误php -v
:
Xdebug requires Zend Engine API version 320190902.
The Zend Engine API version 420200930 which is installed, is newer.
Contact Derick Rethans at https://xdebug.org/docs/faq#api for a later version of Xdebug.
当我运行 phpize 时,我得到了这个输出:
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
所以我不确定我需要在这里做什么。为什么我无法使用正确的 Zend API 版本?
Ubuntu 报告我拥有最新版本的autoconf
,automake
和php-dev