3

I'm using PhpStorm version 8.0.4, server is Debian Wheeze with PHP 5.4.4 and Xdebug 2.1.1.

On PhpStorm I have two projects. Debug on project A works fine, the debugger stops at at breakpoint and I'm able to watch variables and step into functions.

On project B, which has the same debugging configuration of project A, the debugger does not stop at breakpoints.

Both project are stored in the same server, with the same Apache, PHP and Xdebug configuration. They only use different virtual hosts. The only differences I have encountered is that on project A PhpStorm sets the cookie XDEBUG_SESSION on the browser with the IDE key, but on project B the cookie is not set.

Next is a sample debug session on project B:

Log opened at 2015-08-25 07:01:36
I: Checking remote connect back address.
I: Remote address found, connecting to <CLIENT IP>:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/projectB/script.php" language="PHP" protocol_version="1.0" appid="3137"><engine version="2.2.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="4" status="starting" reason="ok"></response>

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///var/www/projectB/script.php" lineno="2"></xdebug:message></response>

<- run -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="stopping" reason="ok"></response>

<- stop -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stop" transaction_id="7" status="stopped" reason="ok"></response>

Log closed at 2015-08-25 07:01:36

UPDATE

The server is on a remote machine, i run PHP (and Xdebug) remotely using SSH. Here is a sample script i'm trying to debug:

<?php
$a=1;
$b=2;
$c=$a+$b;
echo "c is: ".$c;

I've a breakpoint on line 2 ($a=1;). This is the Xdebug log:

Log opened at 2015-08-25 11:06:24
I: Checking remote connect back address.
I: Remote address found, connecting to <CLIENT IP>:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/vhost/test.php" language="PHP" protocol_version="1.0" appid="3602"><engine version="2.2.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="4" status="starting" reason="ok"></response>

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///var/www/vhost/test.php" lineno="2"></xdebug:message></response>

<- run -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="stopping" reason="ok"></response>

<- stop -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stop" transaction_id="7" status="stopped" reason="ok"></response>

Log closed at 2015-08-25 11:06:24
WileTheCoyot
  • 513
  • 1
  • 5
  • 20
  • *"The only differences i have encoured is that on project A PhpStorm sets the cookie XDEBUG_SESSION on the browser with the ide key, but on project B the cookie is not set."* Since the xdebug log was generated .. then it actually works and cookie is not the reason. Must be something else. – LazyOne Aug 25 '15 at 08:43
  • 1) Is webserver and PhpStorm are on the same computer (I mean -- it's not on virtual server/Docker container etc)? 2) What file are you trying to debug (I need full real paths)? If it's remote .. what is the local path? 3) Show us the script you are trying to debug. If it's some real script -- try creating some very basic script and debug it instead. 4) Try upgrading to more recent xdebug version (2.3.2 I believe is the latest) – LazyOne Aug 25 '15 at 08:48
  • @LazyOne i've updated the question. Thank you for your time – WileTheCoyot Aug 25 '15 at 11:15
  • So .. what file you are trying to debug (the remote path)? I see that xdebug session is triggered for `/var/www/gegtrasporti/test.php` but breakpoint is set for `/var/www/vhost/test.php`. From IDE/xdebug point of view those are 2 different files (even if they are at the same location/point to the same file). This may mean that path mappings are not set up correctly in PhpStorm. Keep in mind: xdebug works with final/resolved paths ONLY -- it will resolve any symlinks in the path. – LazyOne Aug 25 '15 at 11:32
  • @LazyOne that was an error on copy/paste the logs. The path is /var/www/vhost/scripts.php. I have added an absolute mapping to the file without any luck – WileTheCoyot Aug 25 '15 at 12:51
  • Pff .. in logs you have `test.php` .. in your message you have `scripts.php` ... In any case: 1) does placing `xdebug_break();` in your php file does anything (considering that you will remove all breakpoints) 2) Consider removing your entries from `PHP | Servers` and try again. it's hard for me to suggest anything concrete when working with heavily modified logs (possible details/nuances may have disappear after such move). – LazyOne Aug 25 '15 at 12:57
  • @LazyOne i have found the solution by myself. Thank you for you time – WileTheCoyot Aug 25 '15 at 14:09

1 Answers1

1

Don't tell me why, but i solved my problem by pressing the "Start listening for PHP Debug Connections" button in the debug menu.

WileTheCoyot
  • 513
  • 1
  • 5
  • 20