2017-03-01 83 views
2

我一直在抛出这个错误,但是我安装了7.1.2版本。为什么我不能./configure在Ubuntu LAMP堆栈上安装xdebug

这是我的错误信息:

checking whether to enable Xdebug support... yes, shared 
checking Check for supported PHP versions... configure: error: not supported. 
Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.3.10-1ubuntu3.26) 
    [email protected]:/var/www/xdebug# php -v 
    PHP 7.1.2-3+deb.sury.org~precise+1 (cli) (built: Feb 22 2017 10:29:40) (NTS) 
    Copyright (c) 1997-2017 The PHP Group 
    Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies 
     with Zend OPcache v7.1.2-3+deb.sury.org~precise+1, Copyright (c) 1999-2017, by Zend Technologies 
    [email protected]:/var/www/xdebug# 

有其他人遇到这个问题。我试过重新安装PHP 7.0和其他一些策略。通读一堆类似的堆栈问题,但我无法弄清楚。

这意味着我不能移动到:make

make install 

cp modules/xdebug.so /etc/php.d/xdebug.so 

回答

2

您正在使用从的OndrejSurý的PPA。因此,您可以使用apt-get install php7.1-xdebug轻松安装xdebug。

编辑:如何-配置XDebug的(基于Ubuntu的Linux系统):

创建ini文件/etc/php/7.1/mods-available/custom.ini并把下面的配置到它:

; priority=90 
[xdebug] 
xdebug.remote_enable=1 
; replace <Host-IP-Address> with the IP of your host system! 
xdebug.remote_host=<Host-IP-Address> 
; You'll need this later. 
xdebug.idekey=PHPSTORM 
xdebug.profiler_enable_trigger=1 

现在激活配置与命令sudo phpenmod -v 7.1 -s ALL custom。不要忘记重新启动您的Web服务器。

其次你需要一个支持dbgp协议的IDE。我使用PhpStorm,速度很快(甚至运行数小时),并且因为它具有原生的Xdebug支持。

你设置完IDE,并在代码中设置至少一个断点,可以触发调试非常简单:

第一种选择:添加查询参数XDEBUG_SESSION_START=PHPSTORM(其中PHPSTORM是值了xdebug.idekey设置在您的配置文件中)。

第二种选择:发送一个包含内容XDEBUG_SESSION=PHPSTORM的cookie与您的请求。 cURL示例:curl -H 'Cookie: XDEBUBG_SESSION=PHPSTORM' http://my-awesome.domain/awesome-script.php

如果你已经正确设置了任何东西,你现在可以玩Xdebug。

Xdebug的 - Documentation
PhpStorm - Configuring Xdebug
PhpStorm - Zero-configuration Web Application Debugging with Xdebug and PhpStorm

最后但并非最不重要的,一些不错的到了Xdebug的设置:

; enable colors for the command-line interface 
xdebug.cli_color=1 

; show more data when using var_dump 
xdebug.max_nesting_level=500 
xdebug.var_display_max_children=512 
xdebug.var_display_max_data=2560 
xdebug.var_display_max_depth=200 

; enable trigger for easy profiling 
xdebug.profiler_enable_trigger=1 

有很好的调试会话:)

+0

谢谢。它看起来像安装并且非常容易。现在,如果我做一个php-v。 (c)2002-2016 Zend Technologies 使用Xdebug v2.5.0,版权所有(c)2002-2016(C)2002-2008,Zend Technologies ,由Derick Rethans – Supplement

+0

这可能是一个愚蠢的问题,我当然会检查你的答案是正确的,因为它为我安装了xdebug。但是,你怎么实际使用调试?工具在哪里,我如何知道它在工作等等? – Supplement

+0

我编辑了我的文章,并添加了一个小的方法来配置Xdebug。 – Kyoya