我正在尝试让 xdebug 在 PHP 7 上工作。我正在从版本 http://xdebug.org/files/xdebug-2.4.0rc4.tgz 构建 xdebug.so 文件. phpize 输出看起来正确( Zend Extension Api No: 320151012
)但是我得到 Xdebug requires Zend Engine API version 220121212.
来自 PHP。
所以我遵循了这些说明:
Tailored Installation Instructions
Summary
Xdebug installed: no Server API: Apache 2.0 Handler Windows: no Zend Server: no PHP Version: 7.0.9-1 Zend API nr: 320151012 PHP API nr: 20151012 Debug Build: no Thread Safe Build: no Configuration File Path: /etc/php/7.0/apache2 Configuration File: /etc/php/7.0/apache2/php.ini Extensions directory: /usr/lib/php/20151012 Instructions
Download xdebug-2.4.1.tgz Unpack the downloaded file with tar -xvzf xdebug-2.4.1.tgz Run: cd xdebug-2.4.1 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: 20151012 Zend Extension Api No: 320151012 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/20151012 Edit /etc/php/7.0/apache2/php.ini and add the line zend_extension = /usr/lib/php/20151012/xdebug.so Restart the webserver
除了我安装了 php7.0-dev 而不是 php5
apt-get install -y php7.0-dev
.
当我运行
phpize
命令我得到以下输出:
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
正如预期的那样。但是,当我运行 PHP 时,我得到:
Xdebug requires Zend Engine API version 220121212.
The Zend Engine API version 320151012 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.
我显然在某个地方做错了什么!非常感谢有关调试问题的任何帮助! :)
请您参考如下方法:
所以我使用 apt-get 包修复了这个问题:apt-get install -y php-xdebug
这似乎安装了正确的 xdebug.so 文件,一切正常!