more remote debugging

Using xdebug.
From the php info results, it looks like the settings are correct.
Highlights attached below.

Server is HQDev01.
Client machine is bwhite.

Have a small page that runs phpinfo, with a breakpoint on that line
and a few before it.

The log looks like it connects with no errors.
Attached below.

Note that the phpinfo results show that autostart is on, but it doesn't
break on the first line.

Where should I go from here?

Thanks,
Brad.

PHPINFO RESULTS

xdebug support enabled
Version 2.2.1
IDE Key PHPSTORM

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

Directive Local Value Master Value
xdebug.idekey no value no value
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 bwhite localhost
xdebug.remote_log /home/brad.white/projects/fdp/application_v2.2/logs/xdebug.remote_log.txt no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000



REMOTE LOG


Log opened at 2012-08-15 14:55:27
I: Connecting to configured address/port: bwhite:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///home/brad.white/projects/fdp/websites/FDP_webapp.php" language="PHP" protocol_version="1.0" appid="21941" idekey="PHPSTORM"><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 0 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="0" feature="show_hidden" success="1"></response>

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

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

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

<- step_into -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///home/brad.white/projects/fdp/system_v2.2/core/Kohana.php" lineno="532"></xdebug:message></response>

<- eval -i 5 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="5"><property address="140733928976144" type="bool"><![CDATA[0]]></property></response>

<- eval -i 6 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="6"><property address="140733928976144" type="bool"><![CDATA[1]]></property></response>

<- eval -i 7 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="7"><property address="140733928976144" type="string" size="27" encoding="base64"><![CDATA[aHFkZXYwMS5jb3JwLmZpcmVzcHJpbmcuY29t]]></property></response>

<- eval -i 8 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="8"><property address="140733928976144" type="string" size="4" encoding="base64"><![CDATA[ODAxMw==]]></property></response>

<- eval -i 9 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property address="140733928976144" type="string" size="61" encoding="base64"><![CDATA[L2NvbnRyb2xsZXIvY29tbWFuZF9zY3JpcHQvdGVzdD9YREVCVUdfU0VTU0lPTl9TVEFSVD1QSFBTVE9STQ==]]></property></response>

<- breakpoint_set -i 10 -t line -f file:///home/brad.white/projects/fdp/application_v2.2/controllers/command_script.php -n 77
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="10" id="219410001"></response>

<- breakpoint_set -i 11 -t line -f file:///home/brad.white/projects/fdp/application_v2.2/controllers/command_script.php -n 78
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="11" id="219410002"></response>

<- breakpoint_set -i 12 -t line -f file:///home/brad.white/projects/fdp/application_v2.2/controllers/command_script.php -n 79
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="12" id="219410003"></response>

<- stack_get -i 13
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="13"><stack where="Kohana::log_save" level="0" type="file" filename="file:///home/brad.white/projects/fdp/system_v2.2/core/Kohana.php" lineno="532"></stack></response>

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

<- run -i 15
Log closed at 2012-08-15 14:55:27

12 comments
Comment actions Permalink

Hi Brad,

What is the local path to the project root?

If xdebug is connecting to PhpStorm (based on the xdebug log it looks like it does) but does not stop on breakpoint, then most likely path mappings are incorrect (local <--> remote -- I doubt that path on local computer (for project files) is exactly the same as on remote server -- quite rare scenario). Please check your settings at "Settings | PHP | Servers". If not sure -- just delete any entries there and start debugging -- PhpStorm should help you set this up on next debug session.

If necessary -- check this article: http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0

P.S.
Instead of debugging your Kohana app straight away, I would suggest trying to debug very simple and basic sript first to ensure that debugger is setup properly on both ends. Once done you can attempt debugging real app (where path mappings can play critical role, in some situations).

0
Comment actions Permalink

Well, that was pretty slick.  It set up the remote server.
Looks like I had the remote port wrong.  Should have been 8013.

Paths look the same.

It connects once, and then never again.  It did that once before,
but I can't reproduce.  Restarted PHPStorm, still doesn't reconnect.
Still never stops at a breakpoint.

I'm setting the remote_host ,etc, in code right before the phpinfo line,
if that matters any.

Clicking Register IDE results in "xdebug proxy: cannot connect" error.

re: start simple
I started with CLI and unit tests, but all the instructions about breakpoints
were regarding the browser, so it seemed simpler to start there.

This page does nothing besides

echo "This is a test";
 ini_set('xdebug.remote_log', '/home/brad.white/projects/fdp/application_v2.2/logs/xdebug.remote_log.txt');
 ini_set('xdebug.remote_host', 'bwhite');
 ini_set('xdebug.remote_enable', '1');
phpinfo( );


I don't know how to get any simpler.

Thanks for the quick answer,
Brad.
0
Comment actions Permalink

TBH I'm confused with what you have tried and what you are trying to do -- the way how you describing/wording is too confusing for me.

Looks like I had the remote port wrong.  Should have been 8013.

Using non-default port? OK -- just make sure it is correct on both remote and local (PHP and PhpStorm)

Clicking Register IDE results in "xdebug proxy: cannot connect" error.

You do not need that unless you know what that is exactly and how it works (as it requires additional software/script to be run on server as a proxy, which you seems to not have one)

re: start simple
I started with CLI and unit tests, but all the instructions about breakpoints
were regarding the browser, so it seemed simpler to start there.

So .. is it remote or local debugging? Debugging remote script in CLI mode requires much more to setup (not as simple as web remote debug).

I don't know how to get any simpler.

This script is simple enough to play with, but I would strongly recommend to setup those values in actual php.ini (or whatever file is used on your server). From what I do understand (this script) that you will only be able to set breakpoint at phpinfo() line only as until then xdebug is not yet configured.

P.S.
If you put xdebug_break(); in the line before phpinfo() -- does it stop ?

0
Comment actions Permalink

> You do not need that
OK.

> So .. is it remote or local debugging?
The files are synced to the server, the web page is served from the server,
the unit tests are run on the server.
Only PHPStorm is on my machine.

I've never tried to run phpunit from my machine.  Let me try that.....
No, command not recognized.

> I would strongly recommend to setup those values in actual php.ini
I can ask if they would do that for me for testing the configuration,
but obviously that would only work for me.  Won't help anyone else.

I'm going to need to get back to work.  Things are piling up.
I'll be back on this issue in 6 hours.

Thanks,
Brad.

0
Comment actions Permalink

I've never tried to run phpunit from my machine.  Let me try that.....
No, command not recognized.

For that to work you will have to have PHP & PHPUnit installed and properly configured on your computer.

> So .. is it remote or local debugging?
The files are synced to the server, the web page is served from the server,
the unit tests are run on the server.
Only PHPStorm is on my machine.

You need to use "web based" debugging, not CLI one since the later one is more complicated to setup, and if you cannot make web one to work then CLI will fail for sure.

Just want to check few things:
1) What is the local path to the project root?
2) What is the remote path (path on the server file system -- is it /home/brad.white/projects/fdp ?)
3) Do you have remote shell access (e.g. SSH/telnet or whatever) to your server? If Yes -- can you activate "Run | Start Listen PHP Debug Connections" (the icon on toolbar should become green instead of red) and then try to connect from your server to your computer via telnet on xdebug port. Do you see the response?

Let's try this:
1. Brand new empty project (in PhpStorm at least)
2. Very simple php script -- make sure that it will be executed directly (to make things simple -- no additional routing or URL rewriting involved)
test.php

<?php
// add your xdebug configuration line here
$a = 3; // breakpoint here
$b = 5;
xdebug_break(); // well, maybe it will be triggered manually then?

$c = $a + $b;
echo "a + b = $c";

3. Enable xdebug log (xdebug's own -- like you already did; + PhpStorm one -- http://devnet.jetbrains.net/docs/DOC-1202)
4. Try to debugging it (I recommend Zero-Confiiguration approach -- see links below). Post those logs here if it still will fail (do it as attachment -- it's easier to read)

Check these articles if required, in case you have not read them yet: http://confluence.jetbrains.net/display/WI/Documentation -- especially the one about xdebug configuration and zero-configuration debug:


If xdebug is configured properly and is able to connect to your PhpStorm (e.g. firewall allows incoming connections for PhpStorm; you have set up port forwarding on your router in case your sever somewhere on Internet) then this approach works like a charm -- works perfectly for me every time I've tried.

0
Comment actions Permalink

> 1) What is the local path to the project root?
C:\Users\brad.white\Documents\projects\PHP\fdp

> 2) What is the remote path (path on the server file system -- is it /home/brad.white/projects/fdp ?)
Yes.

UNC: \\HQDEV01\brad.white\projects\fdp
Server: /home/brad.white/projects/fdp

> 3)  activate "Run | Start Listen PHP Debug Connections" and then try to connect from your server
> to your computer via telnet on xdebug port. Do you see the response?



It looks like it attempts, but I can't tell that it worked.
Is there a command I am supposed to send after it conencts?

telnet> open \\bwhite 9000
Trying 10.10.20.139...
Connected to bwhite.hq.firespring.com (10.10.20.139).
Escape character is '^]'.

> 1. Brand new empty project (in PhpStorm at least)

OK.

> 2. Very simple php script -- no additional routing
Here is my vhost entry

<VirtualHost *:8013>
        DocumentRoot /home/brad.white/projects/test
        ServerName test.brad.php.dev.firespring.com
</VirtualHost>


URL is
http://test.brad.php.dev.firespring.com:8013/test1.php
and I see the page.  Not surprisingly, it doesn't stop on the breakpoint.



> 3. Enable xdebug log
Added
<category name="#com.jetbrains.php.debug">
       <priority value="DEBUG"/>
  </category>


PHP log is empty after startup info.
xdebug log is completely empty.
Also attached partial phpinfo results.

I tried using the 'Start debugging' macro, the chrome extension, and
adding '?XDEBUG_SESSION_START=PHPStorm' to the URL.
Nothing gave any results in the xdebug log.

Feels like we are further away than ever.

Thanks for the help.  Much appreciated.

Brad.


Attachment(s):
xdebug_settings_info.txt.zip
idea.log.zip
0
Comment actions Permalink

I tried to upload the xdebug log file.  But being empty, the server didn't
see any point.     8: -)

PHP Servers settings are empty.

The only xdebug settings I'm setting at runtime are
remote log and remote host.
Remote enable is in the php.ini file.
Remote port is default.

Project settings are:
Port = 9000
Accept external connections
Force break at first line.

That's all the extra details I can think of.

I think the telnet option sounds worth exploring.

Thanks,
Brad.

0
Comment actions Permalink

telnet> open \\bwhite 9000
Trying 10.10.20.139...
Connected to bwhite.hq.firespring.com (10.10.20.139).
Escape character is '^]'.

Just to double check: I hope you were running this command on a server and not your PC? If syntax is correct, then as far as I understand the connection was successfull.

Please show a screenshot of your PhpStorm settings: "PHP | Debug" and " PHP | Servers"

C:\Users\brad.white\Documents\projects\PHP\fdp
/home/brad.white/projects/fdp

If you are doing all setup manually, then these paths should be mapped on "Settings | PHP | Servers". If you were following this article ( http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 ) then such mapping would be created automatically (via simple pop up dialog) when PhpStorm detects incoming xdebug connection (if no entry already defined for that host, of course).

Can you please follow that acrticle when attempting to debug that test project (step #4 in my previous message). If all ports and other settings/firewall are fine, then it should just work (always does work for me, never failed so far).

If you have time and tools -- maybe you can make some screencast (video) of how you doing this and what settings you have etc -- all important details. This possibly would be the best way to see what do you have there (what you may be missing or possibly doing wrong).



Regarding xdebug itself -- I assume it is activated in php.ini (or whenever you activate it) via

zend_extension=
path/to/xdebug.so and not just
extension=
path/to/xdebug.so and that top of phpinfo() page has this (or similar) text:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
0
Comment actions Permalink

The only xdebug settings I'm setting at runtime are
remote log and remote host.

You see -- I think it could be actually the problem.

By default the remote host is localhost (based on your output -- very first post, the "Directive Local Value Master Value" line), which means when xdebug receives debug command (cookie or GET parameter), it will attempt to connect to the server itself. This will happened on very beginning of script execution, before any line will actually be executed. And if you are changing some settings later ... well -- that could be already too late.

I'm not 100% sure on the above, but I think it has high probability to be the case here. That's why I was suggesting setting all settings in php.ini (do you know that you can configure php to pickup other/user ini files (user_ini.filename) or even pass php config values via Apache's .haccess ?) -- If you can -- try this approach in case you cannot edit php.ini itself.

0
Comment actions Permalink

> do you know that you can configure php to pickup other/user ini files (user_ini.filename) or even pass php config values via Apache's .haccess ?

No I didn 't know that.

ini didn't work, but .htaccess did.

We now have breakpoints.
Works from the browser and CLI.

Thanks for the help.

To bad about the documentation being misleading.
http://www.php.net/manual/en/ini.list.php
It has all those values as ALL - can be set anywhere.

Brad.

0
Comment actions Permalink

They have deleted the article you referred to. :-/

0

Please sign in to leave a comment.