【问题标题】:Xdebug bad Zend API Version NumberXdebug 错误 Zend API 版本号
【发布时间】:2013-12-23 07:48:52
【问题描述】:

我在为 MAMP 升级 xdebug 时遇到问题。我运行的是 2.2.0 版,遇到了一个已知问题:PhpStorm and Xdebug not breaking in Symfony2 Controller

我尝试按照http://xdebug.org/wizard.php 的说明升级到 2.2.3 版

下载并解压 xdebug tar 后,我运行 /Applications/MAMP/bin/php/php5.4.4/bin/phpize

这是输出:

Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525

然后我将 modules/xdebug.so 文件复制到 mamp php5.4.4 扩展目录中:`/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts- 20100525/xdebug.

如果我运行/Applications/MAMP/bin/php/php5.4.4/bin/php -v,我会得到以下信息:

Xdebug requires Zend Engine API version 220090626.
The Zend Engine API version 220100525 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.

PHP 5.4.4 (cli) (built: Jul  4 2012 17:28:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

我已重新启动 MAMP 和 Apache 并尝试使用 phpinfo() 加载页面,但我没有看到 Xdebug 列出。如果我将旧的 xdebug.so 文件移回原位,则错误将被删除,phpinfo() 将 xdebug 显示为已启用

【问题讨论】:

    标签: mamp xdebug


    【解决方案1】:

    我设法通过运行解决了这个问题

    /Applications/MAMP/bin/php/php5.4.4/bin/pecl install xdebug 起初我看到使用 pecl 的 Zend API 编号存在问题。我关注了这个帖子:pecl installs for previous php version 并设置了以下内容:

    sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear config-set php_ini /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
    sudo /Applications/MAMP/bin/php/php5.4.4/bin/pecl config-set bin_dir /Applications/MAMP/bin/php/php5.4.4/bin/
    

    不确定这些配置是否与之前失败有关

    【讨论】:

      【解决方案2】:

      我在 Mac Pro 上设置了 MAMP 服务器,我无法让 xDebug 工作。这是在我的日志中:

      PHP Warning:  PHP Startup: xdebug: Unable to initialize module
      Module compiled with module API=20160303
      PHP    compiled with module API=20170718
      These options need to match
       in Unknown on line 0
      

      这可以通过安装最新的 xDebug.so 来解决。我这样做的问题是写入了错误的 xDebug.so,而不是 MAMP 服务器:

      Build process completed successfully
      Installing '/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so'
      ERROR: failed to write /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so (copy(/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so): failed to open stream: Operation not permitted)
      

      @Shawn 回答的第二行是解决方案:

      sudo /Applications/MAMP/bin/php/php7.2.7/bin/pecl config-set bin_dir /Applications/MAMP/bin/php/php7.2.7/bin/
      

      然后我能够使用 pecl install xdebug 将最新的 xDebug.so 构建到正确的目录。

      【讨论】:

      • 你是救命稻草,我已经为这个问题苦苦挣扎了好几个小时!现在版本匹配,不要忘记在运行命令phpize 后验证所有版本是否相同,这将解决问题然后运行sudo pecl install xdebug 现在我的 phpinfo() 在我的情况下显示最新版本:Zend Engine v3.3.24,版权所有 (c) 1998-2018 Zend Technologies 和 Xdebug v3.0.0,版权所有 (c) 2002-2020,Derick Rethans 和 Zend OPcache v7.3.24-3+ubuntu20.04.1+deb.sury.org+ 1,版权所有 (c) 1999-2018,由 Zend Technologies 提供。
      猜你喜欢
      • 1970-01-01
      • 2015-10-30
      • 1970-01-01
      • 2021-04-19
      • 1970-01-01
      • 2013-09-12
      • 2013-01-30
      • 2012-10-05
      • 2020-07-31
      相关资源
      最近更新 更多