简体   繁体   中英

Installing xdebug on Ubuntu LAMP stack

I keep throwing this error but I have version 7.1.2 installed. Why can't I ./configure

Here is my error message:

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)
    root@precise32:/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
    root@precise32:/var/www/xdebug# 

Has anyone else encountered this problem. I've tried reinstalling php 7.0 and several other tactics. Read through a bunch of different stack questions similar but I can't figure it out.

Which means I can't move on to: make

make install

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

You're using the PPA from Ondřej Surý. So you can easily install xdebug by using apt-get install php7.1-xdebug .

Edit: How-To configure Xdebug (on Ubuntu based Linux systems):

Create an ini file /etc/php/7.1/mods-available/custom.ini and put the following configuration into it:

; 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

Now activate the configuration with the command sudo phpenmod -v 7.1 -s ALL custom . Don't forget to restart your web server.

Second you need an IDE which supports the dbgp protocol. I use PhpStorm, it's fast (even it runs for hours) and of cause, it has a native Xdebug support.

After you've set up your IDE and set at least one breakpoint in your code, you can trigger the debugger very simple:

1st option: Add the query parameter XDEBUG_SESSION_START=PHPSTORM (where PHPSTORM is the value of the xdebug.idekey setting in your configuration file).

2nd option: Send a cookie with the content XDEBUG_SESSION=PHPSTORM with your request. cURL example: curl -H 'Cookie: XDEBUBG_SESSION=PHPSTORM' http://my-awesome.domain/awesome-script.php .

If you've set up anything correctly, you can now play with Xdebug.

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

And last but not least, some nice-to-have Xdebug settings:

; 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

Have nice debugging sessions :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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