【问题标题】:Installing xdebug with PHP 5.5使用 PHP 5.5 安装 xdebug
【发布时间】:2013-12-25 19:24:33
【问题描述】:

我已经阅读了很多答案,但无法弄清楚为什么 xdebug 不起作用。

php.ini:

[xdebug]
zend_extension="/usr/lib/php5/20090626/xdebug.so"

php -v:

PHP 5.5.6-1+debphp.org~precise+2 (cli) (built: Nov 21 2013 14:31:41) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

/usr/lib/php5/20090626/xdebug.so 确实存在。 php.ini 中没有 zend 优化器。

如果我尝试安装 xdebug:

pecl/xdebug is already installed and is the same as the released version 2.2.3
install failed

提前致谢。

【问题讨论】:

标签: php xdebug


【解决方案1】:

好的,所以我自己偶然发现了这个。

首先,20090626 库是为 php 5.3 编译的。所以你不能真正使用它。以下是我为了能够将 xdebug 与 php 5.5 一起使用而执行的步骤:

  1. 通过xdebug download页面下载source
  2. 关注guide 将您的源代码编译到 lib 中。
  3. 所以现在扩展位于正确的源文件夹:20121212,您需要在配置中启用 xdebug。
  4. 我使用的是 ubuntu 12.04,因此后续步骤可能不适用于您的系统:

    • 创建 20-xdebug.ini 配置并将其复制到 /etc/php5/apache/conf.d 和 /etc/php5/cli/conf.d 文件夹(当然,如果您打算在 cli 中使用 xdebug) .在此处插入下一行代码:zend_extension=xdebug.so
    • 在 apache2 和 cli php.ini 配置文件中启用 xdebug: xdebug.remote_enable = 1 xdebug.renite_enable = 1 xdebug.max_nesting_level = 1000 xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = '/var/log' 查看有关 xdebug 设置的更多信息:http://xdebug.org/docs/all_settings

php -v:

PHP 5.5.7-1+sury.org~precise+1 (cli) (built: Dec 12 2013 21:37:40) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

【讨论】:

  • @Black 不确定您具体要问什么,但我想让您知道:1)如果您需要“5”或者不需要,请直接使用 php 5.6使用 7.X 版本。 Php 5.5 不在支持期,所以你不应该坚持下去。您可以在windows官方下载页面查看当前版本:windows.php.net/download 2)您可以在官方xdebug下载页面找到对应的Xdebug版本:xdebug.org/download.php
  • @SlayerBirden,结果在哪里,我在任何地方都找不到文件xdebug.so?!
【解决方案2】:

因为这似乎困扰着越来越多试图通过 pecl 安装 xdebug 的人,这里有以下选项:

  • Windows:获取binary
  • Ubuntu (>12.04):sudo apt-get install php5-xdebug
  • Linux(其他):通过包管理器或编译latest source

使用 PECL 为 PHP5.5 安装 X-Debug,@Slayer Birden 也回答 不会 工作到现在,我认为它在不久的将来不会改变。

【讨论】:

  • 我刚刚使用 PECL 为 PHP 5.5 安装了 xdebug。
【解决方案3】:

我在 Ubuntu 14.10 上遇到了类似的问题。我忘了启用 xdebug: sudo php5enmod xdebug 从存储库安装 xdebug 之后: sudo apt-get install php5-xdebug 也不要忘记重新启动网络服务器 sudo service apache2 restart

我的 xdebug.ini 看起来像这样: zend_extension=xdebug.so xdebug.remote_enable = 1

【讨论】:

    【解决方案4】:

    对于 xampp 服务器,首先下载 xdebug 并插入 php 扩展并编辑 php.ini 文件,如下所示:

        [XDebug]
    ; Only Zend OR (!) XDebug
    ; XAMPP and XAMPP Lite 1.7.0 and later come with a bundled xdebug at     C:\xampp/php/ext/php_xdebug-2.3.1-5.5-vc11.dll, without a version number.
    xdebug.remote_enable=1
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    ; Port number must match debugger port number in NetBeans IDE Tools > Options > PHP
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=1
    xdebug.profiler_output_dir="C:\xampp\tmp"
    [PHP_XDEBUG-2.3.1-5.5-VC11]
    zend_extension="C:\xampp\php\ext\php_xdebug-2.3.1-5.5-vc11.dll"
    

    【讨论】:

      【解决方案5】:

      我今天遇到了这个问题。发现download page 上的最新版本实际上可能 工作。下载Xdebug 2.3.0下的那个,选择“PHP 5.5 VC11 TS (32 bit) (MD5: ef4a8994cef26c47ac891d6872e391b3)”。它对我有用。我尝试了 2.3.3 和 2.3.2 版本,之前没有用。

      【讨论】:

        【解决方案6】:

        要为特定版本的 PHP 安装非常特定版本的 Xdebug,您可以通过从源代码编译来完成。例如。如果您想为 PHP 5.6 编译 xdebug-2.5.5,请在控制台(Ubuntu)中运行以下命令:

        sudo apt install php5.6-dev
        cd ~/Downloads
        wget "https://xdebug.org/files/xdebug-2.5.5.tgz" -O "xdebug-2.5.5.tgz"
        tar -xzf xdebug-2.5.5.tgz
        cd xdebug-2.5.5/
        /usr/bin/phpize5.6
        ./configure --enable-xdebug --with-php-config=/usr/bin/php-config5.6
        make
        sudo make install
        

        所有可用的 Xdebug 版本都可以在 here 找到。 Xdebug编译指南为here

        【讨论】:

          猜你喜欢
          • 2014-03-15
          • 2015-03-09
          • 2019-05-27
          • 2011-01-11
          • 2014-04-26
          • 2014-04-19
          • 1970-01-01
          • 2018-09-12
          • 1970-01-01
          相关资源
          最近更新 更多