Debugger (Xdebug) connection only works for some REQUEST_URIs?

Hi,

I am trying to use PhpStorm’s debugging for a project I am working on. Mostly, it does not work—PhpStorm simply does not recognize the incoming debugger connections. But for some REQUEST_URIs, it works, and I simply don’t see a reason for it.

For instance, when invoking one of these paths from the browser, a debugging session starts:

  • /backend/?action=page.edit&id=15
  • /backend/?action=file.content&id=3


On the other hand, invoking most other paths will be ignored by PhpStorm, for example:

  • /backend/?action=page.auth&id=15
  • /backend/?action=file.details&id=3


(FYI: both “page” URLs above are handled by the same controller class, and both “file” URLs are handled by another controller class. In all of the above cases, a cookie “PHPSTORM_XDEBUG_BREAK” with the value “1” is sent to the server.)

To make things even more strange: in any case, breakpoints will be ignored. I have disabled “break at first line”, and in those cases where a debugging session starts, the execution will automatically halt at a line from an external library that does not have a breakpoint.

The setup: PHPStorm 2.1.4 with Xdebug 2.1.0 on Mac OS X with PHP 5.3.8 and Apache. I have not configured any path mappings.

Thanks in advance for any ideas.

Carsten

4 comments
Comment actions Permalink

Hello C B,

Sorry for delay.
Do you use symlinks in your project?

Thank you for feedback!

0
Comment actions Permalink

Hi,

no, this project does not symlinks anymore (I removed them to see if this was the cause of the problem). However, the example URLs I posted are constructed using an Alias directive in the Apache configuration, which, I suppose, is equally bad ;-)
But still, when I try to debug a file in the document root (i.e.: no symlinks, no aliases), it doesn’t work, too.

Let me post an example of a simpler case:

# cd /private/tmp; mkdir demo; cat > demo/index.php <?php echo __LINE__."\n"; echo __LINE__."\n"; # chown -R cb:staff demo # cat >> /etc/hosts 127.0.0.1  demo.loc # cat >> /etc/apache2/other/vhosts.conf <VirtualHost *:80>   ServerName demo.loc   DocumentRoot /private/tmp/demo   <Directory /private/tmp/demo>     Allow From All   </Directory> </VirtualHost> # apachectl restart # curl demo.loc 2 4


In other words: I created a document root with index.php in it, created a local hostname, created a virtual host, and by the curl call, I made sure the host works. Fine.

Then, I created a new project from /private/tmp/demo in PhpStorm and clicked the “Start Listen PHP Debug Connections” toolbar item. I opened a browser (Safari) and opened http://demo.loc/index.php. I saw the expected output, but nothing else happened. I clicked the “Xdebug Start session” and “Xdebug This page” bookmarklets and nothing happend, I clicked each one and reloaded the browser afterwards and nothing happened.
I opened http://demo.loc/index.php in Firefox, chose the “Debug in PhpStorm” Contextual menu item, and as usual, nothing happend.
Maybe I am getting something wrong, but isn’t this supposed to work? Am I missing any essential steps?


Reading this description, you might perhaps think that Xdebug is not installed – but it is. And the strange thing is that for very few cases (regardless of which virtual host), it more or less works, i.e. PhpStorm (or Xdebug) tells me that there’s an incoming connection and asks me if I would like to debug it.

In case it might be of interest, here is part of the Xdebug configuration:

[cb@MacBook ~]$ php -i | fgrep xdebug | fgrep -v .dump | fgrep -v .profiler | fgrep -v .collect
xdebug
xdebug support => enabled
xdebug.auto_trace => Off => Off
xdebug.default_enable => On => On
xdebug.extended_info => On => On
xdebug.file_link_format => txmt://open?url=file://%f&line=%l => txmt://open?url=file://%f&line=%l
xdebug.idekey => cb => PHPSTORM
xdebug.manual_url => http://macbook.loc/docs/php/manual/ => http://macbook.loc/docs/php/manual/
xdebug.max_nesting_level => 100 => 100
xdebug.overload_var_dump => On => On
xdebug.remote_autostart => On => On
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => jit => jit
xdebug.remote_port => 9000 => 9000
xdebug.scream => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => On => On
xdebug.show_mem_delta => On => On
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /private/tmp => /private/tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 80 => 80
xdebug.var_display_max_depth => 3 => 3



TIA for any hints
Carsten
0
Comment actions Permalink

C B,

no, this project does not symlinks anymore (I removed them to see if this was the cause of the problem). However, the example URLs I posted are constructed using an Alias directive in the Apache configuration, which, I suppose, is equally bad ;-)

You can still use symlinks or apache alias directive if you wil set up proper path mappings - see 'How do I specify path mappings?' section in http://blog.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/

I opened http://demo.loc/index.php in Firefox, chose the “Debug in PhpStorm” Contextual menu item, and as usual, nothing happend.

It is JavaScript run/debug configuration.

xdebug.remote_mode => jit => jit

It is actually why debugging is not working fo you (see http://xdebug.org/docs/remote#remote_mode). You should edit your php.ini file and set:
xdebug.remote_mode = 'req'

Thank you for feedback!

0
Comment actions Permalink

You made my day! It was that f*ing JIT mode indeed!

Thanks,
Carsten

0

Please sign in to leave a comment.