PHPStorm 2017.3 Debug Stopped Working [resolved]
It's probably been a few weeks since I used XDebug with PHPStorm, but when I did it was setup perfectly. Since then I've upgraded to PHPStorm 2017.3 and not much else has changed ... nothing with my local dev setup ... and now debugging no longer works.
Here's my setup...
Macbook Pro
Homebrew install of php7.1 and xdebug
Local server is Laravel Valet
Application is WordPress
Here's what I've done to resolve the issue...
- Ensured I'm on the latest version of everything in homebrew
- Re-setup xdebug following instructions from https://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide and https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
- Validated my setup in PHPStorm under Debugging Preferences and got all green checkmarks
- Setup logs for both XDebug and PHPStorm
Here's my php.ini xdebug block...
[XDebug]
zend_extension="/usr/local/opt/php71-xdebug/xdebug.so"
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_port=9001
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
Here's the output from xdebug's log...
Log opened at 2017-12-06 14:48:13
I: Connecting to configured address/port: 127.0.0.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/me/.composer/vendor/laravel/valet/server.php" language="PHP" xdebug:language_version="7.1.6" protocol_version="1.0" appid="10977" idekey="14374"><engine version="2.5.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="break" reason="ok"><xdebug:message filename="file:///Users/me/Sites/blvd/wp-content/plugins/hji-blvd-framework/app/utils/Lumber.php" lineno="110"></xdebug:message></response>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2017-12-06 14:48:24
Everything should work but PHPStorm never pauses on a breakpoint. I've even tried to use the xdebug_break(); function....nothing.
Please sign in to leave a comment.
According to the PHPStorm log it looks like there's a java error - I have a reference to another log file (java_error_in_phpstorm_%p.log) in my home directory.
Even tried to re-install the app, with the same result.
Oh! Now that I think about it, I recently updated to the latest version of Java on this machine.
Rolled back to version 2017.2.4 and everything is working again. Looks like a PHPStorm / Java Bug.
Right now everything looks like it wasn't PhpStorm listening to 9001.
Please install 2017.3 back, stop all PhpStorm instances (both 2017.2.4 and 2017.3, if any) and initiate a debug session again.
What does the Xdebug log say? Could it connect?
Thanks Eugene, I did that and Xdebug log was saying that it was connecting. I logged debugging from PHPstorm which complained about java errors mostly.
If there's no PhpStorm running, and yet port 9001 is available, then something else is listening to it stopping PhpStorm from accepting debugging connections.
Check that PhpStorm is not running with Activity Monitor, then run lsof -n -i:9001 | grep LISTEN
It's also possible that there was a hanging PhpStorm instance occupying the port though, but I think you should have noticed its crash/unresponsiveness.
Yeah, I even rebooted the entire machine a few times so I don't that anything was hanging on port 9001 but who knows. The important thing is that I'm back to work for now...I'll try to upgrade again later.
I'm not sure why this was marked as resolved if it wasn't. Xdebug stopped working for me when I upgraded, and now even downgrading isn't fixing it.
When I run a phpunit test with debugging, the unit test runs fine but a popup says "Connection with Xdebug 2.5.5 was not established. Validate installation.". The validation passes, and it says to check configuration (which I haven't changed and I know is good.)
Are there any known bugs with this?
What PHP interpreter do you use for PHPUnit? Is it local or remote?
Docker. For anyone coming to this thread later, the solution can be found in the comments here: https://youtrack.jetbrains.com/issue/WI-38060
This is a problem for me too, and I am super unhappy of having to screw around with a dev environment that worked fine before the upgrade
I just upgrade from PhpStorm-171.4694.2 to PhpStorm-181.4668.78
I use its debugging capabilities all the time; it worked fine before the upgrade.
php.ini:
[Zend]
zend_extension = /usr/lib/php/20151012/xdebug.so
xdebug.profiler_output_dir="/tmp/xdebug/"
xdebug.profiler_enable=On
xdebug.remote_enable=On
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Please configure and check Xdebug remote log, it's very useful in such cases:
https://intellij-support.jetbrains.com/hc/en-us/articles/206544819-How-to-collect-remote-log-for-XDebug