使用 PHP 5.5 安装 xdebug

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20457856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:12:53  来源:igfitidea点击:

Installing xdebug with PHP 5.5

phpxdebug

提问by Victor

I've read quite a lot answers but couldn't figure out why xdebug doesn't work.

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

php.ini:

php.ini:

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

php -v:

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 does exist. No zend optimizer in php.ini.

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

Also if I try to install xdebug:

另外,如果我尝试安装 xdebug:

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

Thanks in advance.

提前致谢。

采纳答案by Slayer Birden

Ok so I've stumbled upon this myself.

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

First of all, the 20090626 lib is compiled for php 5.3. So you can't really use that. Here are the steps I've performed in order to be able to use xdebug with php 5.5:

首先,20090626 lib是为php 5.3编译的。所以你不能真正使用它。以下是我执行的步骤,以便能够在 php 5.5 中使用 xdebug:

  1. Download the sourcevia xdebug downloadpage.
  2. Follow this guidefor compiling your source into lib.
  3. So now the extension is in correct source folder: 20121212, and you need to enable xdebug in your config.
  4. I'm on ubuntu 12.04, so next steps might not work with your system:

    • create 20-xdebug.ini config and copy it to both /etc/php5/apache/conf.d and /etc/php5/cli/conf.d folders (if you plan on using xdebug in your cli of course). Insert next line of code there: zend_extension=xdebug.so
    • enable xdebug in both apache2 and cli php.ini configuration files:
      xdebug.remote_enable = 1
      xdebug.renite_enable = 1
      xdebug.max_nesting_level = 1000
      xdebug.profiler_enable_trigger = 1
      xdebug.profiler_output_dir = '/var/log'
      
      See more about xdebug settings: http://xdebug.org/docs/all_settings
  1. 通过xdebug 下载页面下载源代码
  2. 按照本指南将源代码编译为 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 -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

回答by Jimmy Kane

Since this seems to bother more and more people trying to install xdebug via pecl here are the options:

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

  • Windows: Get the binary
  • Ubuntu(>12.04): sudo apt-get install php5-xdebug
  • Linux(other): via package manager or compilethe latest source

Using PECL to install X-Debug for PHP5.5 as @Slayer Birden also answered will notwork up to now and I don't think it will change in the near future.

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

回答by akovar

I had a similar problem on Ubuntu 14.10. I forgot to enable xdebug: sudo php5enmod xdebugafterinstalling xdebug from repository: sudo apt-get install php5-xdebugAlso do not forget to restart web server sudo service apache2 restart

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

My xdebug.ini looks like this:zend_extension=xdebug.so xdebug.remote_enable = 1

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

回答by zheek

for xampp server first download xdebug and insert into php extention and edit php.ini file like this:

对于 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"

回答by Hammad Khan

I ran into this problem today. Found out that the latest version on download pagemight actually notwork. Download the one under Xdebug 2.3.0, select "PHP 5.5 VC11 TS (32 bit) (MD5: ef4a8994cef26c47ac891d6872e391b3)". It worked for me. I tried ver 2.3.3 and 2.3.2 before which did not work.

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