Can't make xdebug work with php -S

Here's how I'm trying to make debugging in PHPStorm work:
1. Start php local web server using php -S 127.0.0.1:8002 -t /home/gadelat/Documents/Orange
2. In PHPStorm, Start listening for incoming PHP Debug Connections
3. In web browser, enable debugging and load page http://127.0.0.1:8002/

Here is what I get:
snapshot2.png
If I click "Accept", here is what I get next:
snapshot1.png

Clicking on "Accept" at previous dialog creates following PHP server in settings:
snapshot3.png
Which is, in my opinion correct. But anyway, If I try to use mappings (even though I am not supposed to since paths are same on local and web server) and set it like this:
snapshot4.png

nothing changes.

Debugging works for another project which uses web server in virtual machine

5 comments
Comment actions Permalink

Hi there,

1) Did you put valid breakpoints anywhere? (by valid I mean that xdebug is unable to stop at certain lines due to the way how PHP generates bytecode, e.g. multiline array, some multiline statements etc; that's why the breakpoints should be set on simple / single line statements)

2) What xdebug log says about it?

3) Will it break if you put xdebug_break(); in your code (programmatic breakpoint) ?

4) Will it break if you do as suggested on 2nd screenshot (enable breaking at first line)?

0
Comment actions Permalink

You were right, php didn't reach to the part of my application where I set the breakpoint. That was stupid from me not to check that. Case solved.

0
Comment actions Permalink

Hi there!

I'm evaluating PHPStorm and I'm facing the same problem. Can't make xdebug stop in any breakpoint in php code.

This is the log file for xdebug:

Log opened at xxxx
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:///www/myproject/whereis.php" language="PHP" xdebug:language_version="5.6.19" protocol_version="1.0" appid="1377" idekey="PHPSTORM"><engine version="2.4.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 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 xxxx

 

This is the php file I want to debug:

 

<?php
$hello = "world";
(*) if($hello == "my") {
echo "GREAT <br>";
}
var_dump($hello);
phpinfo();

The breakpoint is in the line market with (*).

I run the PHPStorm debug check tool and everything seems in place.

I do not know what to try more... Any hints?

Regards.

0
Comment actions Permalink

Hi Mike,

1) Is it running locally (not VM or remote computer)?

2) Do you have any "proper" web server installed on your PC (Apache/Nginx/etc)?

3) If you do -- how's your PHP is running there (apache module/fastcgi/etc)?

 

P.S. You should really do this as separate thread .. as it's different to what the original author experienced (he solved his issue AFAIK)

0
Comment actions Permalink

Thanks Andriy. 

I will open a new thread and answer your questions.

Best.

0

Please sign in to leave a comment.