简体   繁体   English

尝试使用 PHP 8.0 安装 Xdebug - 已安装的 Zend Engine API 版本 420200930 较新

[英]Trying to install Xdebug with PHP 8.0 - The Zend Engine API version 420200930 which is installed, is newer

I've recently installed PHP 8.0 on my Ubuntu 20.04 server and I'm trying to get Xdebug working with it.我最近在我的 Ubuntu 20.04 服务器上安装了 PHP 8.0,我正在尝试让 Xdebug 使用它。 I've installed it as per the directions from https://xdebug.org/wizard :我已经按照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.

But I get this error when doing php -v :但是在执行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.

When I ran phpize, I got this output:当我运行 phpize 时,我得到了这个 output:

Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902

So I'm not sure what I need to do here.所以我不确定我需要在这里做什么。 Why am I unable to use the right Zend API version?为什么我无法使用正确的 Zend API 版本?

Ubuntu reports that I have the lastest versions of autoconf , automake and php-dev Ubuntu 报告我有最新版本的autoconfautomakephp-dev

I had exactly the same issue.我有完全相同的问题。 After some investigation I realized the problem was caused because the configuration path assumed during the compiling process was pointing to the global php-config (another php version).经过一番调查,我意识到问题是因为在编译过程中假定的配置路径指向全局 php-config(另一个 php 版本)。 So I just had to run the compilation with the flag (Xampp in my case):所以我只需要使用标志运行编译(在我的例子中是 Xampp):

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

The next steps were the same you did and it works like a charm.接下来的步骤与您所做的相同,它就像一个魅力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM