Xampp - breakpoints not working

I have created a new project and cannot make any breakpoints work.

The virtual server on my localhost is named mydomain.local. So the address http://mydomain.local opens the php application. When creating a new project from existing sources, I chose the first option from the wizard, which is for the case when the source files are directly in the web root folder. So I think the wizard took care of the Deployment settings and they look correct to me (the local path and project url are correct). Then I configured manually the Run/Debug configuration. However, I can't make the breakpoints work and I can't check how it was in my previous project because it is deleted.. (previous project had no problems with php debugging)

My test: I opened http://mydomain.local/index.php in editor and introduced a small bug on one line, then debugged it. There was a php error. Then I corrected the bug and set breakpoints at this line and lines surrounding it, just to be sure and chose "Debug mydomain.local". The debugger didn't stop on these breakpoints and opened the page normally. The console says "Waiting for incoming connection with ide key xx"

Setting "Break on first line" also doesn't stop the debugger, as well as changing the browser.

Please take a look at my config, what is wrong, what else to check?



phpstormsettings.jpg
P.S. clicking on the image makess it more readible

7 comments
Comment actions Permalink

Hi there,

The type of Run/Debug Configuration makes big difference as "PHP Web Application" one requires you to control xdebugger (via bookmarklet or some browser extension) while "PHP Remote Debug" will initiate debugger for you.

It can also be a path mappings thing if symlinks (or alike) are used.

0
Comment actions Permalink

Isn't it the opposite? Because when I use "PHP Remote debug" mode instead of "PHP Web application" then after pressing "Debug" nothing happens (the page is not opened automatically) except that a message "Waiting for connection with ide key '1' appears.

Not sure if this is the way to go in case of Remote debugging, but after typing into the browser url "http://mydomain.local/?XDEBUG_SESSION_START=1" (such string was in the url when I used the other debug mode, only key was different) the page just loads and "Waiting..." is still there. No stop on breakpoints.

phpstormsettings2.jpg

Anyways, I would like to just press Debug and the debugger should start the page which is specified in configuration.

I don't have symbolic links (this is Windows) or any other hard shortcuts.

Update:
According to the bookmarklet link you posted, I also tried the following string with Remote debug: http://mydomain.local/?XDEBUG_SESSION=PHPSTORM;path=/ but it doesn't stop the debugger either. I don't know where to put the session key=1 into this string

By the way, the Bookmarklet link works this way: after pressing Generate and copying the xdebug Start Session link, this is copied to clipboard:
javascript:(/**%20@version%200.5.1%20*/function()%20{document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})()
I think one needs to change it a little as I did above.

Message was edited by: beamar

0
Comment actions Permalink

I fixed it. Sorry, it was not a Php Storm issue, it was an issue with my XDebug configuration. I reinstalled Xampp but did not reinstall XDebug (because new Xampp did not touch my php.ini, old and new were identical, Apache and MySql had the identical configuration, so I thought Xdebug also does not need reinstall). Well, after reinstalling Xdebug all is ok again.

0
Comment actions Permalink
Isn't it the opposite?

You are correct -- my mistake.

Try this for PHP Web Application configuration:

  • when you defining server, Host field -- instead of localhost put correct domain name: mydomain.local
  • ensure that you have "Break at the first line" checked


In general -- maybe you have changed php/xdebug config? Please check:

  • port number is the same (default is 9000)
  • xdebug.remote_host has correct IP  (localhost is fine)
  • if PhpStorm is listening on that port (Activate "Run | Start Listen PHP Debug Connections" and check it with netstat command (or similar))
  • Try with firewall disabled (or allow full access for PhpStorm.exe)


If I create PHP Web Application configuration and provide this kind of URL ( http://idetest.dev/test.php ) then this is the actual URL that will be launched: http://idetest.dev/test.php?XDEBUG_SESSION_START=12026

By the way, the Bookmarklet link works this way: after pressing Generate and copying the xdebug Start Session link, this is copied to clipboard:
javascript:(/**%20@version%200.5.1%20*/function()%20{document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})()
I think one needs to change it a little as I did above.

You do not need to change anything -- no need for copying it:

  • after generating just drag link to a bookmark bar,
  • when ready to debug:
    • Make usre that you on a correct tab
    • click on your Start bookmark -- this will set the debug cookie
    • now refresh the page (if current page is the one you want to debug), or click on a link to such page / submit a form etc
    • the debug cookie will be sent together with page request,

I don't know where to put the session key=1 into this string

You have to put that session key (which is "1") into appropriate field on bookmarklet generator before hitting "Generate" button.

I don't have symbolic links (this is Windows) or any other hard shortcuts.

Windows Vista and above already supporting symbolic links. In previous versions (Win 2000 and newer) Junction points were available (for folders only). Why I think you may had some links/mapped drive etc -- the drive letter I:/ -- quite high (quite possible it's some sort of substitution/joint point .. or you seems to have a lot of partitions/hdds etc).

In any case -- if none of the above helps, please collect debugger logs (ideally both) -- it may tell you straight away what is going on (if xdebug is trying to connect or not; if yes -- why no connection succeeds (path mapping issue?)):

0
Comment actions Permalink

Ahh .. good to know -- while I was typing my reply and waiting until it finish posting (takes like 5 mins or so to post) you already fixed it ... Now all my ideas ca be thrown in a bin :)

0
Comment actions Permalink

Thanks fo the tips - I'll have to use Remote debugging soon anyway , so it'll be useful to know the configuration tricks.

0

Please sign in to leave a comment.