简体   繁体   English

使用 PHP 5.5 安装 xdebug

[英]Installing xdebug with PHP 5.5

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. /usr/lib/php5/20090626/xdebug.so 确实存在。 No zend optimizer in php.ini. 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.提前致谢。

Ok so I've stumbled upon this myself.好的,所以我自己偶然发现了这个。

First of all, the 20090626 lib is compiled for php 5.3.首先,20090626 lib是为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:以下是我执行的步骤,以便能够在 php 5.5 中使用 xdebug:

  1. Download the source via xdebug download page.通过xdebug 下载页面下载源代码
  2. Follow this guide for compiling your source into lib.按照本指南将源代码编译为 lib。
  3. So now the extension is in correct source folder: 20121212, and you need to enable xdebug in your config.所以现在扩展在正确的源文件夹中:20121212,你需要在你的配置中启用 xdebug。
  4. I'm on ubuntu 12.04, so next steps might not work with your system:我使用的是 ubuntu 12.04,所以接下来的步骤可能不适用于您的系统:

    • 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).创建 20-xdebug.ini 配置并将其复制到 /etc/php5/apache/conf.d 和 /etc/php5/cli/conf.d 文件夹(当然,如果您计划在 cli 中使用 xdebug)。 Insert next line of code there: zend_extension=xdebug.so在那里插入下一行代码: zend_extension=xdebug.so
    • enable xdebug in both apache2 and cli php.ini configuration files:在 apache2 和 cli php.ini 配置文件中启用 xdebug:
      \nxdebug.remote_enable = 1 xdebug.remote_enable = 1\nxdebug.renite_enable = 1 xdebug.renite_enable = 1\nxdebug.max_nesting_level = 1000 xdebug.max_nesting_level = 1000\nxdebug.profiler_enable_trigger = 1 xdebug.profiler_enable_trigger = 1\nxdebug.profiler_output_dir = '/var/log' xdebug.profiler_output_dir = '/var/log'\n
      See more about xdebug settings: http://xdebug.org/docs/all_settings查看有关 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

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 Windows :获取二进制文件
  • Ubuntu (>12.04): sudo apt-get install php5-xdebug Ubuntu (>12.04): sudo apt-get install php5-xdebug
  • Linux (other): via package manager or compile the latest source Linux (其他):通过包管理器或编译最新源代码

Using PECL to install X-Debug for PHP5.5 as @Slayer Birden also answered will not work up to now and I don't think it will change in the near future.使用PECL安装X-调试的PHP5.5作为@Slayer Birden也回答起来工作了,我不认为它会在不久的将来发生改变。

I had a similar problem on Ubuntu 14.10.我在 Ubuntu 14.10 上遇到了类似的问题。 I forgot to enable xdebug: sudo php5enmod xdebug after installing xdebug from repository: sudo apt-get install php5-xdebug Also do not forget to restart web server sudo service apache2 restart我忘了启用 xdebug: sudo php5enmod xdebug从存储库安装sudo 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

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"

I ran into this problem today.我今天遇到了这个问题。 Found out that the latest version on download page might actually not work.发现,在最新版本的下载页面实际上可能无法正常工作。 Download the one under Xdebug 2.3.0, select "PHP 5.5 VC11 TS (32 bit) (MD5: ef4a8994cef26c47ac891d6872e391b3)".下载Xdebug 2.3.0下的那个,选择“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.我之前尝试过 2.3.3 和 2.3.2 版本,但没有用。

To install a very specific version of Xdebug for a specific version of PHP you can do it by compilation from sources.要为特定版本的 PHP 安装非常特定版本的 Xdebug,您可以通过从源代码编译来完成。 Eg if you would like to compile xdebug-2.5.5 for PHP 5.6 run following commands in console (Ubuntu):例如,如果您想为 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

All available versions of Xdebug can be found here .可以在此处找到 Xdebug 的所有可用版本。 Xdebug compilation guide is here . Xdebug 编译指南在这里

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

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