Zero Config Debug not working, but everything connects...?

I will save the hours of description about how I spent a long time trying to get Zero Config Debug working, and have failed.  But here is the summary:

I have PHPStorm 3.0.3. PHP 5.3.10  xDebug 2.1.4

I followed the steps on this page (among the dozens of other pages I consulted)  http://webexplorations.com/blog/?p=584

It’s really straightforward.  Everything is installed. But I can’t get it to work.

(And it’s infinitely better than: http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0  Because it doesn’t show me pages that don’t exit in 3.0 )

It *does* generate a log.  It *does* connect to the IDE.  The log shows the *same file* in the IDE as coming from the server.  Except the slashes vs back slashes for directory delimiters.  But it doesn’t break on the break point.

The Google debug helper is set to ‘Other’  and ide key is PHPSTORM, as is set all over the IDE as well.

My INI settings are below.  It is unclear if they go in xDebug, or PHP, but the info page picks them up in either. (I tried all different ways, I have them in both.)  The log is attached.

When I turn off the bug in Google, it doesn’t connect to the IDE.

When I turn on the bug, but turn off the ‘listen’ in the IDE, I don’t get a log, and the page blocks for several seconds trying to reach the IDE.

So, I know it’s connecting, I can see the log showing communication back and forth, I can see the file in the log matches the file in the IDE.  But the IDE never breaks on the break point I set.

Any help is appreciated.  I am evaluating this for purchase.

Scott Weber

INI settings:

zend_extension = "C:\Program Files\PHP\ext\php_xdebug-2.1.4-5.3-vc9.dll"

xdebug.remote_enable=1

xdebug.profiler_enable=1

xdebug.remote_port=9000

xdebug.remote_host = 127.0.0.1

xdebug.remote_handler = dbgp

xdebug.remote_mode = req

xdebug.remote_log=c:\data\logs\xdebug.log

xdebug.remote_autostart=1

xdebug.idekey=PHPSTORM



Attachment(s):
xdebug.log.zip
0
27 comments

Hi Scott,

It looks like xdebug extension is configured ok (I mean your settings in php.ini).

  • What file you are trying to debug?
  • Where it is located on your disk (full path)?
  • Did you setup "Settings | PHP | Servers"?


I think PhpStorm is unable to map remote file to the one in your project (I can easily be wrong here but those are my thoughts right now).

Would be great if you post screenshots of all settings in PhpStorm related to the debugging.

P.S.
You do not need XDebug Proxy (article is wrong about it) -- it can be used for REMOTE debugging by few developers simultaneously from different computers and requires actual proxy software running on remote server.

P.P.S.
In my personal opinion article from JetBrains website is OK as PhpStorm already has most (if not all) of the settings set to their defaults.

0

I just tried to setup debug from very scratch (PhpStorm side only as xdebug/php.ini is already done).

All what I had to do is:
1. Create brand new empty project
1.b. Create a website for that project in your web server (I guess it is IIS) -- I'm suing separate website for each project, domain name is fakened via hosts file. In my case website is served from the same location where project is.
2. Create empty index.php file and put some simple content there:

<?php

$a = 2;
$b = 3;
$z = $a +$b;
echo '$z = ' . $z;
echo " for sure!";

3. Set breakpoint at line #3 ($a = 2;)
4. Activate "Listen" button in PhpStorm (must become green)

Now -- browser part:
1. Open website in browser (in my case it was http://debug.dev/index.php )
2. Set xdebug cookies to activate debug session (via similar browser extension -- turn the bug on/green)
3. Refresh the page in browser (request actual page)

One second later (or even quicker) PhpStorm window start flashing (because it was in background) and new popup window appeared -- PhpStorm asked for mappings (how remote url that I'm trying to debug reflects the file on the disk) -- the defaults were fine. Click OK and debug session has started. ALL DONE.

To sum it up -- in PhpStorm I had only to 1) set up breakpoint, 2) activate "debugger listener", 3) provide path mappings (by clicking OK button).

0
Avatar
Permanently deleted user

Thanks for your quick response.  
I agree that it thinks the file on the server is different from the IDE.  But they aren't, except for the directory delimiters.
I am using this in IIS, but since the debug connection is from google or PHP to the IDE, I don't think it will care that it's in IIS.  Especially since I can see the connection being make.

I ran the base64 encoded strings from the log through my decoder, and saw it was looking for a cookie that wasn't there. You can see that I set the cookie in the source.  Now the log reply is ."... type="bool"><![CDATA[1]]></property>... "  Where it used to be CDATA[0] for the cookie request.
So I know the cookie is there (although I thought the Google Helper plugin was in place of the cookie, but I'm trying everything )

All the rest of the things in the log seemed fine.

To save time, I captured screen shots, it should answer everything.
1.  Ide.jpg -  shows the file I am running, it's path in the project window.  And shows the 'telephone' set to listening mode.

2. debug.jpg - Show my debug settings

3. servers.jpg - shows the IIS server ssetting, root path, etc...

4. Google.jpg - shows the Google helper.  You can see the IDE KEY name, and the little bug on the address bar.  The bug lites up green when ready to debug.

5. Test.jpg - Shows the output from the page. You can see the URL, and the little bug is green.  But no matter how many times I hit 'Refresh', it doesn't break.  just keeps going.

Thanks... so far.



Attachment(s):
test.jpg
google.jpg
servers.jpg
debug.jpg
ide.jpg
0

Settings | PHP | Servers

You should either untick "Use path mappings" .. or provide value for "Absolute path on the server" column (same as value on left column -- which makes no sense of having it there in your simple case, unless symbolic links are used).

0
Avatar
Permanently deleted user

I repeated your test.  But still nothing.   See comments.

Bazzik wrote:

I just tried to setup debug from very scratch (PhpStorm side only as xdebug/php.ini is already done).

All what I had to do is:
1. Create brand new empty project

I deleted the ".idea" folder, and moved everything out of the way.  It said "Do you want to create a project from the files there?"  I said no. So I got a new one.

1.b. Create a website for that project in your web server (I guess it is IIS) -- I'm suing separate website for each project, domain name is fakened via hosts file. In my case website is served from the same location where project is.

Mine was created in the InetPub folder, called wwwroot, so it is also in the same place as the project (as was also described in my previous answer)

2. Create empty index.php file and put some simple content there:

<?php

$a = 2;
$b = 3;
$z = $a +$b;
echo '$z = ' . $z;
echo " for sure!";

Cut and pasted.  There is no closing tag  ?>  so I added one.

4. Activate "Listen" button in PhpStorm (must become green)

Lit up green, and little sound waves going into the earpeice :-)

1. Open website in browser (in my case it was http://debug.dev/index.php )

localhost/index.php

2. Set xdebug cookies to activate debug session (via similar browser extension -- turn the bug on/green

It was already on when I initially load the page.  I cycled through it...  Profile -> diasabled -> green  Just to be sure.

3. Refresh the page in browser (request actual page)

One second later (or even quicker) PhpStorm window start flashing (because it was in background) and new popup window appeared -- PhpStorm asked for mappings (how remote url that I'm trying to debug reflects the file on the disk) -- the defaults were fine. Click OK and debug session has started. ALL DONE.

Never flashed. Never asked for mappings.  Served up the page "z = 5 for sure".

I changed it to 2+4 = 6 to see if it didn't cache it.  It didn't  I started getting "z = 6".  but still no flash, no breakpoint, no mapping request.

Let's keep digging!  Whatever else you need, I'll test it.

Thanks.

0
Avatar
Permanently deleted user

Bazzik wrote:

Settings | PHP | Servers

You should either untick "Use path mappings" .. or provide value for "Absolute path on the server" column (same as value on left column -- which makes no sense of having it there in your simple case, unless symbolic links are used).

Well, the PHP box was empty, as was Servers.  Probably the result of blowing away the 'idea' folder and creating a new project.
I added my PHP5.3 back under Settings | PHP,  and added the IIS under Settings | PHP | Servers.  Left the Use Path Mappings off.

Still nothing.

0
Avatar
Permanently deleted user

To complicate matters:
When I turn off the debug in google, it still conencts to the IDE and creates a log.

When I 'hang-up' on the IDE (stop listening), google hangs for a few seconds trying to connect to the IDE.  But no log.

So I'm thinking something is messed up in Google Chrome.  But I don't know what.

-Scott

0
There is no closing tag  ?>  so I added one.

Closing tag is optional.

Never flashed. Never asked for mappings

It only should ask for mappings on first run (when no "PHP | Servers" defined yet) and only if that option "Settings | PHP | Debug | Force break at first line when no path mapping specified" is selected (which is should be selected by default).

Well -- lets try using Run Configuration to initiate debug session:

  1. Turn off "listen" in PhpStorm and unset cookie in browser (bug should be gray)
  2. Run | Edit Configurations
  3. Create new one of "PHP Web Application" type
  4. Select "Server" (you should have one configured by now -- if not just do one) and enter url ("/index.php" will be fine)
  5. Save .., select this configuration in dropdown box on main toolbar (if not selected already) and click on "Debug" button
0
So I'm thinking something is messed up in Google Chrome.  But I don't know what.

No -- it's your xdebug settings:

xdebug.remote_autostart=1

With the setting above it will attempt to debug the page on EACH page request, so you do not need any browser extension etc -- http://xdebug.org/docs/all_settings#remote_autostart


Try putting this line in your php file (first code line) to invoke debugger from script itself: http://xdebug.org/docs/all_functions

xdebug_break();


If still nothing -- please collect php debugging logs from PhpStorm side: http://devnet.jetbrains.net/docs/DOC-1202

Also #1 -- provide output of phpinfo(); -- xdebug section (to check xdebug settings).

Also #2 -- please consider archiving your whole simple project (including/especially .idea folder) and attach it to this thread -- maybe (just maybe) you are still missing something on PhpStorm side (hard to tell, really).
0
Avatar
Permanently deleted user

Bazzik wrote:

So I'm thinking something is messed up in Google Chrome.  But I don't know what.

No -- it's your xdebug settings:

xdebug.remote_autostart=1

With the setting above it will attempt to debug the page on EACH page request, so you do not need any browser extension etc -- http://xdebug.org/docs/all_settings#remote_autostart

Well, that was frustrating me, so I disabled, then removed the browser extension, but it STILL tries to connect.

Now I know why.  Thanks.

0
Avatar
Permanently deleted user

Also..
Set xdebug.remote_autostart=0  so it won't try to connect automatically...?  but left xdebug.remote_enable=1

And had to select a browser:  Chrome

Jackpot!  It hit the breakpoint.  I also ran it against the "info.php" script shown earlier.  And it works.

So, we don't know why it won't run in "Zero Config" mode.  

Thanks for your help so far.  I don't know if you can advise me on the next challenge...

Because I was shooting for running Zero Config, which is what I think I will need because I want to debug a script that recieves POST data from an HTML page running javascript.  So that means my StartURL needs to be the the HTML page, not the PHP script.  And when I do that, it still doesn't work.

In other words:

URL = search.php  hits break points.  Ok, but there is no POST data. (yes, I saw how I could manually set the POST data)
So I try
URL = example.html -> calls search.php with an AJAX call. but doesn't hit the break point.
I'm guessing there is some way that the IDE invokes the PHP to cause it to connect back to the IDE.  And I would need to mimic it in my AJAX...?

The way my HTML java script is calling it is:

     xmlHttp.open("POST", "http://localhost/search.php", true);
     xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     xmlHttp.onreadystatechange = loadComplete;
      xmlHttp.send(poststring);



So, that's where I am now.

Thansk again for the help so far.
0
Set xdebug.remote_autostart=0  so it won't try to connect automatically...?  but left xdebug.remote_enable=1

Worked fine for me regardless of remote_autostart value

So that means my StartURL needs to be the the HTML page, not the PHP script.  And when I do that, it still doesn't work.

Well -- xdebug will initiate debugging session only if it sees appropriate cookie/query string parameter present before processing the request -- and I do not know for sure if cookie is sent with your javascript call.

You have few choices here:

  1. use xdebug.remote_autostart=1  (so xdebug  initiates debugging session on each request to php page)
  2. send xdebug query parameter together with URL (which is not ideal at all) -- only required if cookie is not sent together with request.
  3. programmatically invoke debugger from within php script using xdebug_break(); (have tried this myself long time ago, so not 100% sure how exactly this behaves)


Not so long ago I was using jQuery for issuing AJAX requests .. and xdebug cookies were sent just fine together with the actual request (well -- debugging was working fine without any extra moves from my side) so I did not need to use any of the above.

0
Avatar
Permanently deleted user

Cool.  Then I'll have to learn more about JQuery.  I'm really weak on that one.
I know I've had to add headers to the AJAX call the way I'm doing it now.  So there is no telling if the cookie it being sent without more digging.

I tried the debug through AJAX, and it didn't work (as I described).  I will add the remote_autostart back in and try it again.  Maybe that will work.  But for now I'm done for the evening.

You have few choices here:

  1. use xdebug.remote_autostart=1  (so xdebug  initiates debugging session on each request to php page)

Seems to me option #1 is what we were already trying with the Zero Config mode. And it wasn't working.

Not so long ago I was using jQuery for issuing AJAX requests .. and xdebug cookies were sent just fine together with the actual request (well -- debugging was working fine without any extra moves from my side) so I did not need to use any of the above.

And debugging is working for you in the Zero Config mode too.  But something is out of wack on my machine.  So I am treading very lightly as I move forward.

Thanks again.

0
Avatar
Permanently deleted user

Ok, you have no idea how frustrating this is.

I fired up my laptop to continue testing this.  Leaving the other machine alone.

I performed that HTML calling PHP as we discussed.  It worked.

Then I shut down the IDE.  Without rebooting, I restarted the IDE and retested.  Now it won't hit the breakpoint.

Flaky or moody.  I'm not sure which.

And this is on a different machine. but still running IIS, PHP 5.3.10, PHPStorm 3.0.3 and Google Chrome.  Just different files.

I'm ready to bunch that whole image and send it to you guys.  Tomorrow night.

-Scott

0

You can try RC build of v4 (I'm expecting v4 final to be realeased within a week or two) -- maybe it will work better for you (I have no issues with both v3 & v4) -- http://www.jetbrains.net/confluence/display/wi

Because it's new version, it stores settings in different folder -- you will need to use "File | Export Settings ..." and then "File | Import Settings..." to copy them over (or copy them manually -- it just a bunch of files).
http://blog.jetbrains.com/webide/2012/02/phpstorm-webstorm-4-0-early-access-program-started/

0

1) Downloads are down while we prepping new build

2) Settings import wizard was turned on in RC1 and usually works

0
2) Settings import wizard was turned on in RC1 and usually works

Good to hear. I was not aware about this.

I was checking status of "Startup config wizard" (in PhpStorm & WebStorm Development Roadmap page) and it is still "in progress". Plus ... I'm using v4 EAP builds for the long time and have not noticed it when installed RC1 (for obvious reasons, I guess, since I already have v4 config in place).

0

Thats a different beast - its one that suggest you to set up color scheme and keyboard and some other at very first start. Works if NO any configs. Postponed due to bugs.

0
Avatar
Permanently deleted user

I should make a point here...  I can debug the script directly in the IDE. Just set my debug config to PHP Script and it works.
That is, no browser window pops up, it just steps through the PHP code.

It is not breaking when an HTML page is launched that posts something to the script, or in Zero Config mode.  (Well, it did once, but that was it)

As for V4, setup is so easy I don't think much of just doing a raw install.

Tonight I will gut my folders, and start from scratch. Run some test sessions, then bundle up the relavent files and post them, per your other comment.  Today will be busy, so I don't expect to get it done until late.

As a long time C++ developer, I'd like to see it work in V3 as expected.  I've got something going on that should be of interest to make the environment more robust.

Thanks so far.

-Scott

0
Avatar
Permanently deleted user

Hi, Scott,

Please follow these steps to check Zero-Configuration:

  1. Remove your xdebug.log file
  2. Set 'xdebug.remote_enable=1' in your 'php.ini'
  3. Set 'xdebug.remote_autostart=1' in your 'php.ini'
  4. Delete all servers from 'Project Settings' | 'PHP' | 'Servers'
  5. Enable 'Listen' button in the PhpStorm
  6. Put a breakpoint in the PHP script
  7. Refresh a page in a web browser


If there still some problems, please attach your 'xdebug.log' file here.

Thank you for feedback!

0

Here is one way to bypass a lot of these problems.

Setup the python dbgp proxy[it's a fairly easy process under linux] running on the same system as the web server.
Configure xdebug to auto connect to localhost for all connections
Configure PHP storm to connect to the dbgp proxy

Run the proxy in an active ssh session instead of as a daemon so you can see it work.

When you click "listen" in PHPStorm you will see a response on screen from the dbgp server saying you connected and what your label is.

When you run a PHP script you will see the XDEBUG server connecting to the dbgp proxy.  

It makes life a lot easier when you can SEE and watch these connections so you know it is working.

Now, there are 4 possible states when you load a page:

XDebug working on server and in PHPStorm - you see the two connections, they get tied together, and you get to debug.

XDebug working on server and in PHPStorm - but misconfigured labels.  So you will see PHPStorm connect to the server as "mydebugsessionname" and then you will see the XDebug system connect with a different name, so you know WHY it isn't working.

XDebug working on server, PHPStorm not connected:  XDebug connects to the proxy, the proxy doesn't find any listeners, the proxy tells xdebug to run without breakpoints
XDebug not working on server, PHPStorm connected.   You will see your PHPStorm client connection, and the lack of any XDebug connection tells you it's Xdebug.

0
Avatar
Permanently deleted user

Did every step.  Event with the 'debug helper' green in Google Chrome.  Still no breakpoint.

The flow is this:  HTML page uses Javascript to POST to message.php  The PHP just echos back some text, which the page shows in an 'alert' box.

The page works fine.  But the debugger never catches the breakpoint.



I have attached the log.

I attached my entire project, which resides in the wwwroot folder of IIS.  That way I can edit the files in place, and just hit refresh.

I attached the ENTIRE phpinfo() output, you can see I updated it for remote autostart.

Attachment(s):
Wwwroot.zip
UpdatedPHPINFO.txt.zip
xdebug_ZERO_CONFIG.log.zip
0
Avatar
Permanently deleted user

This was a 'Zero Configuration' test only.  And it did not work.

Did every step.  Even with the 'debug helper' green in Google Chrome.  Still no breakpoint.

The flow is this:  HTML page uses Javascript to POST to 'message.php'  The PHP just echos back some text, which the page shows in an 'alert' box.

The page works fine.  But the debugger never catches the breakpoint.

When I just run 'localhost/message.php' I see the text that PHP echos, but the breakpoint is not hit.  That is the log called "xdebug_ZERO_CFG_JUST_PHP.log"

I have attached the log that uses the AJAX call.  That is the log called "xdebug_ZERO_CONFIG.log"

I attached my entire project, which resides in the wwwroot folder of IIS.  That way I can edit the files in place, and just hit refresh.

I attached the ENTIRE phpinfo() output, you can see I updated it for remote autostart, along with all the other settings.

Thanks for any assistance.

-Scott Weber



Attachment(s):
UpdatedPHPINFO.txt.zip
xdebug_ZERO_CFG_JUST_PHP.log.zip
xdebug_ZERO_CONFIG.log.zip
Wwwroot.zip
0
Avatar
Permanently deleted user

Ok, I tried the zero config test that Nikolay suggested.  no luck.

I also did a bunch of 'Web Applicaiton' configuration tests.  They failed when the page had to do an AJAX post.  or even a regular form submission.
By failed, I mean the break point didn't get hit.

I have attached my whole project, as well as the logs.  And a text file that describes the steps one by one.  This should prove to be some boring reading :-)

Also, my phpinfo output is attached too.

Seems to me that when you press 'Debug' is puts a value on the URL which is the IDE KEY, and is waiting for that to come back in the debugger.  but since the page is being sent by AJAX, how does the PHP interpretor know the IDE KEY?
Or, when I have remote_autostart = 1, how does it know the IDE KEY that the IDE wants?
Or, when I use the xdebug helper, it has the IDE key ser to PHPSTORM, so the debuger doesn't know that?  Is still waiting for the numeric IDE KEY

Lastly, after I installed the XDebug helper back in (these test it was still un-installed), every time I press 'Debug', the browser pops up without a bug on the address bar.  Not sure why, because it's there when I launch the browser normally.

Thanks for your help so far.

-Scott Weber



Attachment(s):
Wwwroot.zip
AllLogs.zip
tests.txt.zip
phpinfo.txt.zip
0
Avatar
Permanently deleted user

Wel, well, well...
Sometimes, by asking questions, you start to realize what it is you don't know, and then try something new.
I can now debug with a 'remote debug configuration'.

Both the Zero Config, and the 'PHP Web Application' debug methods still don't hit break points.  So that is still a problem.

But I realized the xDebug helper uses a key of PHPSTORM, and I found the remote debug lets me set a key.  So I did, and ran it repeatedly.  It hits the break point reliably.

I also reloaded my development project, and was able to step through PHP code that arrived from the AJAX call.

So, although debugging isn't working properly in the other settings, at least I can proceed down this configuration.  And that's what makes this IDE worth it.  I'm gonna register. :-)

Thanks guys!  Please let me know when you find out what the issue was with the other configuraitons.

-Scott Weber

0
Avatar
Permanently deleted user

Hi, Scott,

Sorry for the delay.

Do you still have the issue with debugging?

Thank you for feedback!

0
Avatar
Permanently deleted user

Yes, the issue is unchanged since I last posted it. I must use the 'remote debug' rather than Zero Configuration or PHP Application.

So I'm able to use it, but not get the features that are promoted.

See my post on Apr 18, 2012 6:01 AM  which opens:
"Wel, well, well...Sometimes, by asking questions, you start to realize what it is you don't know, and then try something new."

Thanks.

0

Please sign in to leave a comment.