16

I've been beating my head against this for hours.

I've come back to do some work in PHPStorm after not having used it in a couple of weeks, and for some reason the debug doesn't work any more. It used to work, but now it doesn't and I have no idea what is going on.

I'm running on Windows, using IIS, PHP version 5.3.8. The XDebug is installed, and I've set the configuration in PHP.ini as per the usual instructions.

When I run phpinfo() everything looks normal (ie. XDebug is there).

I've rechecked various settings, downloaded a slightly newer version of XDebug than I was using (Xdebug v2.2.1), but nothing seems to kick it into life.

Can someone please give me some clues as to what I can look at next?

UPDATE:

I've spent a few more hours beating my head against this, and don't seem to have gotten much further. XDebug is installed and loaded, according to phpinfo(). I turned on logging, but it doesn't really tell me much except that XDebug is indeed connecting...

Log opened at 2013-02-17 04:13:07
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/web/dbg/index.php" language="PHP" protocol_version="1.0" appid="6912" 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>

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

Log closed at 2013-02-17 04:13:07

So it seems that the problem is on the PHPStorm side, but I cannot see where. I tried creating a very simple project, but could not get that to debug either.

xtempore
  • 5,260
  • 4
  • 36
  • 43
  • 2
    Firewall blocking incoming connections (it's xdebug who connects to IDE)? Wrong port configured? Wrong php.ini edited (or loaded by PHP)? – LazyOne Feb 15 '13 at 10:29
  • I think it's the right php.ini, because I can see from phpinfo() that XDebug is loaded, and is the version I just installed. Could it be a firewall thing? I would have thought that as I am just connecting to the local machine it wouldn't need to pass through any firewall, but I'll look into that. Is there any way to get XDebug to log what is happening? – xtempore Feb 15 '13 at 21:22
  • http://xdebug.org/docs/all_settings#remote_log – CrazyCoder Feb 15 '13 at 21:36
  • **1)** On PhpStorm side: devnet.jetbrains.net/docs/DOC-1202 **2)** on xdebug side: http://xdebug.org/docs/all_settings#remote_log If PHP and PhpStorm are on the same machine, then firewall is unlikely to be the issue. – LazyOne Feb 15 '13 at 21:38
  • 1
    I suggest: **1)** Use `Run | Start Listen PHP Debug Connections` and check if PhpStorm is listening on correct ports (use `netstat` or [TCPView](http://technet.microsoft.com/en-gb/sysinternals/bb897437.aspx) for that) **2)** See if you can connect to that port (while listening) using `telnet` **3)** Try debugging on **brand new** empty project with **very basic script** (just few basic lines) -- maybe it is your specific project misconfiguration (e.g. incorrect path mappings etc). Good article:http://confluence.jetbrains.com/display/WI/Documentation – LazyOne Feb 15 '13 at 21:43
  • The first time I used this it was SOOOO easy. I was really impressed that with the "zero configuration debugging", but now I cannot get even a hint of debugging action out of PHPStorm. – xtempore Feb 17 '13 at 04:22
  • Don't know if it provides an additional clue, but now even trying to debug directly in the IDE doesn't work. It gives message "Connection with 'xdebug' was not extablished". Also shows a link "Validate installation", which when clicked gives message "'xdebug' extension is installed. Check configuration options." – xtempore Feb 17 '13 at 04:44

11 Answers11

29

Don't you hate it when you spend hours wrestling with something, then in desperation try something simple, and it works?

I decided to try a different port, 9001 instead of the default 9000, and it WORKED!

I now realise that I recently installed Twonky (for video streaming to my TV), and when I checked the settings, there it was... port 9000.

xtempore
  • 5,260
  • 4
  • 36
  • 43
  • 2
    Took me the longest time to think of checking if anything else was listening on port 9000... Ran `sudo lsof -i :9000` and killed that process. – allejo Feb 03 '17 at 00:33
  • In my case the culprit was _php-fpm_ (PHP FastCGI Process Manager). Its default port is 9000 too. – Glutexo Mar 30 '17 at 07:03
  • On Windows: run cmd.exe as admin (right click) and then type "netstat -ab" scroll up to 9000. AVG must have introduced some new monitor since my last time debugging a project as it was using 9000! – ja_him May 14 '18 at 13:44
  • **For me the issue was that `xdebug.remote_port` was replaced by `xdebug.client_port` in Xdebug 3** (with `9003` as default, and `remote_port` was silently ignored) – Top-Master Nov 03 '21 at 15:34
8

Had the same issue this afternoon - found this question along with several other SO questions so I thought I'd post the solution that fixed it for me.

I was missing a mapping to the file system. Which is odd because I've seen PHPStorm prompt me when they've been missing previously.

enter image description here

Hopefully this helps someone in the future :)

cloakedninjas
  • 4,007
  • 2
  • 31
  • 45
3

Had the same problem after updating to El Capitan. First hint to that I used is Run -> Web Server Debug Validation. This tool from PHPStorm gave me a hint about xdebug.remote_host I'm using v-hosts and it was complaining localhost being not the correct value there. So I updated xdebug setting with xdebug.remote_connect_back=On and it worked!

Brock
  • 1,635
  • 2
  • 18
  • 27
  • 1
    Your answer helps me, thanks. After migrating to PHP 7 new configuration files was created for PHP modules. So all my settings (including `xdebug.remote_connect_back=On`) was not applied. – Alexander Borisov Apr 19 '16 at 13:19
2

Apparently if you try to debug on newer versions of xdebug you have to include this line to your xdebug-php.ini settings xdebug.mode=debug

Senthu
  • 21
  • 3
1

I had same problem and I resolved it by deleting all the watches, and then reboot phpStorm

1

I resolved by by myself also, cause PHP-Storm and PHP-FPM are listening same port... just kill all php-fpm port. enter image description here

Mike Nguyen
  • 1,024
  • 1
  • 11
  • 16
1

Had the same problem. For me I was using port 9010 for xdebug. Problem turned out to be Logitech's GHub software I recently installed for a new mouse listens on port 9010! You can use this to see what is listening on a given port on Macs:

lsof -nP -iTCP:9010 | grep LISTEN
Rooster242
  • 911
  • 3
  • 10
  • 19
0

Newer versions of PHPStorm have Debugger validation. The official PHPStorm Blog has a writeup on this feature which might help you figure it out.

One snafu for me when I set up a box with php-fpm configured is that php-fpm runs on port 9000 by default also, so I had to change the configured port in php.ini and PHPStorm's preferences to something like 9001.

For what it's worth, my current php.ini setup for xdebug:

[xdebug]
zend_extension="/the/path/to/xdebug.so"
xdebug.file_link_format="txmt://open?url=file://%f&line=%l"
xdebug.remote_enable=1
xdebug.remote_autostart=On
xdebug.remote_port=9001
xdebug.profiler_enable_trigger=1
xdebug.max_nesting_level=250
Paul Redmond
  • 683
  • 7
  • 17
0

I had the same problem! I finally realized that all my configurations were correct, but on the browser side, I hadn't enabled debugging with the Chrome Browser. Each browser has their own way of enabling the debugging to start working.

Dan
  • 1
  • 1
0

I had the same issue and I tried all the solutions I could find in SO and in other sites (checked that both phpStorm and Xdebug are on the same ports, checked that I had the server mapping on the file system, reinstalled Xdebug, etc.) but eventually the problem was in the fact that we run the site on an internal server, and someone from IT changed my computer's IP address to an address which is filtered out of the allowed addresses that can be connected to that server. That's why phpStorm started to ignore the breakpoints from Xdebug.

Hopefully, this will help someone in the future and save him many hours.

resurrecteds
  • 5,176
  • 2
  • 16
  • 18
-1

Found that if xdebug log file is not writable then it could be not working. Always better to set xdebug.remote_log and make it writable.