Having a hard time debugging a simple Symphony starter project using Xdebug

Hi,

Having a frustrating time setting up debugging with a simple Symphony project. Started to learn Symphony and was going through the getting started guides (https://symfony.com/doc/current/getting_started/index.html). So this is a very basic project that simply displays "hello" or something rather.

First, I have Xdebug installed and I can debug a php file with no issues. I use Chrome with the XDebug Helper extension.

My php.ini file for xdebug setting is:

;xdebug.remote_autostart=1
;xdebug.remote_connect_back=1
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000
;xdebug.remote_handler = dbgp

Notice I have a few lines commented out, it's because I was trying to experiment with various settings. Tried to enable all commented out lines, then enable them one-by-one in various ways. Nothing.

I have found and article on Medium "The easiest way to debug a symfony application in phpstorm" (https://medium.com/@ahmetmertsevinc/the-easiest-way-to-debug-a-symfony-application-in-phpstorm-25d609e374a7). That did not help either.

I attach a few screenshots of my configuration. When I start debugging it just goes through the code without stopping on the breakpoint. Could someone please tell me what am I doing wrong?

Thanks.

 

This is the code. Just some basic stuff from Symphony's getting started guide.

 

My run/debug configuration.

 

And my php server configuration.

4 comments

The settings seem legit. Your Symfony project is located in the Sites folder, so I have to ask - you are opening the project in a browser with localhost:8000 and not localhost:80, right?

If so, how exactly do you trigger a debugging session, with the Xdebug Helper extension?

Usually, looking at the Xdebug remote log is very helpful in such cases, please configure it and check what it says when you start a session.

0

Yes, I am using localhost:8000.

I'm using the Xdebug Help xtension with Chrome.

1. Simply press the little "Phone" icon in PHPStorm

2. Press the "Debug" icon to start debugging

3. Then I switch to Chrome, making sure the Xdebug xtension is set to debug mode.

4. Refresh the page.

 

I get the message in PHPStorm

"Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for '127.0.0.1' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu)."

 

0

As far as the xdebug_log... this is what I get in the file:

==========

Log opened at 2019-02-26 10:04:41
I: Connecting to configured address/port: 127.0.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/admin/Sites/php/symfony/quick_tour/bin/console" language="PHP" xdebug:language_version="7.1.25" protocol_version="1.0" appid="9780" idekey="11216"><engine version="2.5.3"><![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>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- feature_set -i 4 -n extended_properties -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- status -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="5" status="starting" reason="ok"></response>

<- step_into -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file:///Users/admin/Sites/php/symfony/quick_tour/bin/console" lineno="9"></xdebug:message></response>

<- breakpoint_set -i 7 -t line -f file:///Users/admin/Sites/php/index.php -n 27
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7" id="97800001"></response>

<- breakpoint_set -i 8 -t line -f file:///Users/admin/Sites/php/symfony/quick_tour/src/Controller/DefaultController.php -n 17
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="97800002"></response>

<- stack_get -i 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="9"><stack where="{main}" level="0" type="file" filename="file:///Users/admin/Sites/php/symfony/quick_tour/bin/console" lineno="9"></stack></response>

<- run -i 10
Log opened at 2019-02-26 10:04:50
I: Connecting to configured address/port: localhost:9000.
W: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (19).
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" language="PHP" xdebug:language_version="7.1.25" protocol_version="1.0" appid="9788" idekey="PHPSTORM"><engine version="2.5.3"><![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>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- feature_set -i 4 -n extended_properties -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- feature_set -i 5 -n notify_ok -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- stdout -i 6 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="6" success="1"></response>

<- status -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="7" status="starting" reason="ok"></response>

<- step_into -i 8
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" lineno="25"></xdebug:message></response>

<- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property type="bool"><![CDATA[0]]></property></response>

<- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[1]]></property></response>

<- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="string" size="9" encoding="base64"><![CDATA[MTI3LjAuMC4x]]></property></response>

<- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="4" encoding="base64"><![CDATA[ODAwMA==]]></property></response>

<- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="13" encoding="base64"><![CDATA[L2hlbGxvL2xlc2xpZQ==]]></property></response>

<- breakpoint_set -i 14 -t line -f file:///Users/admin/Sites/php/index.php -n 27
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="14" id="97880001"></response>

<- breakpoint_set -i 15 -t line -f file:///Users/admin/Sites/php/symfony/quick_tour/src/Controller/DefaultController.php -n 17
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="97880002"></response>

<- stack_get -i 16
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="16"><stack where="{main}" level="0" type="file" filename="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" lineno="25"></stack></response>

HERE I GET AT LEAST 2 PAGES OF ASCII (what it seems like) GARBAGE... THEN CONTINUES...

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

<- run -i 18
Log closed at 2019-02-26 10:04:51

Log opened at 2019-02-26 10:04:51
I: Connecting to configured address/port: localhost:9000.
W: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (19).
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" language="PHP" xdebug:language_version="7.1.25" protocol_version="1.0" appid="9788" idekey="PHPSTORM"><engine version="2.5.3"><![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>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- feature_set -i 4 -n extended_properties -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- feature_set -i 5 -n notify_ok -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- stdout -i 6 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="6" success="1"></response>

<- status -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="7" status="starting" reason="ok"></response>

<- step_into -i 8
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" lineno="25"></xdebug:message></response>

<- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property type="bool"><![CDATA[0]]></property></response>

<- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[1]]></property></response>

<- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="string" size="9" encoding="base64"><![CDATA[MTI3LjAuMC4x]]></property></response>

<- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="4" encoding="base64"><![CDATA[ODAwMA==]]></property></response>

<- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="12" encoding="base64"><![CDATA[L193ZHQvMGU2Mzkz]]></property></response>

<- breakpoint_set -i 14 -t line -f file:///Users/admin/Sites/php/index.php -n 27
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="14" id="97880003"></response>

<- breakpoint_set -i 15 -t line -f file:///Users/admin/Sites/php/symfony/quick_tour/src/Controller/DefaultController.php -n 17
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="97880004"></response>

<- stack_get -i 16
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="16"><stack where="{main}" level="0" type="file" filename="file:///Users/admin/Sites/php/symfony/quick_tour/vendor/symfony/web-server-bundle/Resources/router.php" lineno="25"></stack></response>

ANOTHER PAGE OR TWO OF ASCII GARBAGE HERE

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

<- run -i 18
Log closed at 2019-02-26 10:04:51

0

Debugging session goes through file:///Users/admin/Sites/php/index.php that is outside of a project - that's why debugging fails. Any chance to move index.php into a project and route the app calls through it?

1

Please sign in to leave a comment.