Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm, Xdebug and Google Chrome debugging

Tags:

php

phpstorm

I spent all day on this and still cannot get the debugger to work in PHPStorm with Google Chrome. These are the steps I took insofar:

1) Locate xdebug extension after installation:

locate xdebug.so
# => /usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so

2) Insert the extension in the php.ini file:

php –ini
# => Configuration File (php.ini) Path: /etc
# => Loaded Configuration File:         /etc/php.ini
sudo vim /etc/php.ini
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so

3) Confirm xdebug is working:

php -v
PHP 5.4.30 (cli) (built: Jul 29 2014 23:43:29) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

4) Go to PHPStorm > Preferences > Languages and Frameworks > PHP. Click the expand icon (a square box) on the same line as “Interpreter:”. Enter in the php executable path. Click the refresh box so that the debugger version pops up. Click ok and apply.

enter image description here

5) Toggle the “Start Listening for PHP Debug Connections” button in PHPStorm.

enter image description here

6) Set a breakpoint in source code.

enter image description here

7) Go to this url https://www.jetbrains.com/phpstorm/marklets/. Select Generate under Xdebug. Drag "Start debugger", "Stop debugger", and "Debug this page" into the Bookmarks Bar in Google Chrome.

enter image description here

8) I then reload the web page in browser and no break at all. I even tried using the xdebug google chrome extension and that doesn't work either. In their video, however, it worked:

https://www.jetbrains.com/phpstorm/documentation/phpstorm-video-tutorials.jsp#10

What am I missing here?

As per the answer below, this is what phpinfo has for xdebug extension:

xdebug

xdebug support  enabled
Version 2.2.3
IDE Key no value

Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $

Directive   Local Value Master Value
xdebug.auto_trace   Off Off
xdebug.cli_color    0   0
xdebug.collect_assignments  Off Off
xdebug.collect_includes On  On
xdebug.collect_params   0   0
xdebug.collect_return   Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable  On  On
xdebug.default_enable   On  On
xdebug.dump.COOKIE  no value    no value
xdebug.dump.ENV no value    no value
xdebug.dump.FILES   no value    no value
xdebug.dump.GET no value    no value
xdebug.dump.POST    no value    no value
xdebug.dump.REQUEST no value    no value
xdebug.dump.SERVER  no value    no value
xdebug.dump.SESSION no value    no value
xdebug.dump_globals On  On
xdebug.dump_once    On  On
xdebug.dump_undefined   Off Off
xdebug.extended_info    On  On
xdebug.file_link_format no value    no value
xdebug.idekey   no value    no value
xdebug.max_nesting_level    100 100
xdebug.overload_var_dump    On  On
xdebug.profiler_aggregate   Off Off
xdebug.profiler_append  Off Off
xdebug.profiler_enable  Off Off
xdebug.profiler_enable_trigger  Off Off
xdebug.profiler_output_dir  /var/tmp/   /var/tmp/
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
xdebug.remote_autostart Off Off
xdebug.remote_connect_back  Off Off
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    Off Off
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  localhost   localhost
xdebug.remote_log   no value    no value
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.scream   Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars  Off Off
xdebug.show_mem_delta   Off Off
xdebug.trace_enable_trigger Off Off
xdebug.trace_format 0   0
xdebug.trace_options    0   0
xdebug.trace_output_dir /var/tmp/   /var/tmp/
xdebug.trace_output_name    trace.%c    trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth    3   3
like image 330
Donato Avatar asked Apr 17 '15 21:04

Donato


1 Answers

First of all take a look at phpinfo() output in the browser:

<?php
    phpinfo(); 
    exit;
?>

Sometimes people edit wrong version of php.ini (for example specified for PHP CLI, not for Web Server) - I met such case several times in my practice. Location of this file depends on your system and to learn more you can read this post: Dude, where's my php.ini?

Then you need to check specified values for your XDebug instance. If you need to change something you should open php.ini and find a section [Xdebug] there.

In author's case we figured out that problem was in xdebug.remote_enable. So the fix was:

[Xdebug]
xdebug.remote_enable = 1

Also I recommend to read "XDebug Installation Guide" from "Jet Brains" team: https://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide in which they cover the same steps as I described but in a more detailed manner.

like image 83
Vladimir Posvistelik Avatar answered Oct 07 '22 10:10

Vladimir Posvistelik