【问题标题】:Trying to install Xdebug with PHP 8.0 - The Zend Engine API version 420200930 which is installed, is newer尝试使用 PHP 8.0 安装 Xdebug - 安装的 Zend Engine API 版本 420200930 较新
【发布时间】:2021-04-19 23:32:38
【问题描述】:

我最近在我的 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 报告我拥有最新版本的 autoconfautomakephp-dev

【问题讨论】:

  • 也许您的php.ini 中的某些内容正在查看在不同位置为 PHP 7 构建的旧 XDebug 副本?

标签: php xdebug php-8


【解决方案1】:

我遇到了完全相同的问题。经过一番调查,我意识到问题是由于在编译过程中假设的配置路径指向全局 php-config (另一个 php 版本)。所以我只需要使用标志运行编译(在我的例子中是 Xampp):

./configure --with-php-config=/opt/lampp/bin/php-config

接下来的步骤与您所做的相同,并且效果很好。

【讨论】:

    猜你喜欢
    • 2020-03-24
    • 2022-01-07
    • 2013-12-25
    • 1970-01-01
    • 2015-12-22
    • 2021-05-23
    • 2017-01-31
    • 2020-08-21
    • 2022-11-03
    相关资源
    最近更新 更多