Debug Symfony 1.4 on Mac

I'm trying to debug a Symfony 1.4 project with XDebug on a Mac with El Capitan (10.11.6).

With NetBeans I have no problem configuring the debugging options and to run the debug.

While with PHPStorm it always stops at the first line of the dispatcher and not going inside the project.

Is there a way to configure PHPStorm and XDebug to run properly?

Thank you

 

14 comments

Hi there,

Quite possible it needs some paths mappings (especially when symlinks are in use).

If you have not seen it yet -- please check here first: https://confluence.jetbrains.com/display/PhpStorm/Debugging+with+PhpStorm

0

Ciao Andriy, thank you for your answer.

I tried with several configurations but no one worked so far.

Can you please give me some example on mapping?

Thank you

0

Well ... it's all rather project specific ... and not necessarily mean that you need it (especially since I know nothing about your setup).

But in short: mappings can be setup at "Settings/Preferences | Languages & Frameworks | PHP | Servers"

You better show what you have got there, where your project files are located etc.

It would also help a lot if you can provide xdebug log for such unsuccessful debug session (https://xdebug.org/docs/all_settings#remote_log)

0

Hello Andriy, thanks again for your answer.

It's a symfony 1.4 project with standard settings.
Local host is on http://davide.local
Virtual host is configured like this:

<VirtualHost *:80>
  ServerName davide.local
  DocumentRoot "/Users/davide/Sites/davide/web"
  DirectoryIndex index.php
  <Directory "/Users/davide/Sites/davide/web">
    Require all granted
  </Directory>
</VirtualHost>

Even considering a basic routing rule like: http://davide.local/ it should let me debug the action in

/Users/davide/Sites/davide/apps/frontend/modules/homepage/actions/actions.class.php

But it stops at the web/index.php file and doesn't go inside the action.

Any idea?

0

Davide, is the PhpStorm project located in the web root, or you copy the files in the web root via a deployment configuration?

0

Hello Eugene, no, the PHPStorm project is located in the project folder: /Users/davide/Sites/davide

Should I move it to /web ?

In the /web I just have the index.php 

The problem is that all the logic (and the code) of the application is in the "davide/" folder and not in the "web/" one...

Thank you

0

 

Since the project itself both includes the web root and other code, I think it should work without mappings.

Could you please collect the log Andriy mentioned?

0

Ciao guys, thanks for your answers.

Here is a log with a single breakdown - not working:

Log opened at 2017-03-20 09:39:56
I: Connecting to configured address/port: davide.local:9009.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/davide/Sites/davide/web/index.php" language="PHP" protocol_version="1.0" appid="2597" idekey="PHPSTORM"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 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>

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

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Users/davide/Sites/davide/web/index.php" lineno="4"></xdebug:message></response>

<- breakpoint_set -i 6 -t line -f file:///Users/davide/Sites/davide/web/apps/frontend/modules/fthomepage/actions/actions.class.php -n 29
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="25970001"></response>

<- stack_get -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file:///Users/davide/Sites/davide/web/index.php" lineno="4"></stack></response>

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

<- run -i 9
Log closed at 2017-03-20 09:39:57

0

@Davide

Have you edited the log (file paths in it)?

 

The reason I'm asking -- xdebug breaks and IDE seems to agree on that in

/Users/davide/Sites/davide/web/index.php

But at the same time it shows stack info for

/Users/davidemontorio/Sites/Skipso/challenges/web/index.php

which does not seem to be a part of the project (same file but accessed via different path?)

0

@Andriy Oh sorry. I edited the answer, now it's ok.

0

You see -- editing the file paths .. you may introduce another problems -- like "Do I read the path correctly?" or "Is the path letter case is correct" issues.

 

In any case:

In the log I see breakpoint to be set in

/Users/davide/Sites/davide/web/apps/frontend/modules/fthomepage/actions/actions.class.php

but previously it was mentioned as

/Users/davide/Sites/davide/apps/frontend/modules/homepage/actions/actions.class.php

 

So ...

1) Is that file definitely gets executed? Maybe some another file gets called instead.

2) If you place xdebug_break(); in that file (on a line before your current breakpoint; programmatic breakpoint) -- will it break? Show the xdebug log for such case.

3) After it breaks in index.php -- instead of just Run ... can you use "Step In/Step Over" and navigate into your code step by step? At what point it will stop working?

4) Consider updating your xdebug to newer version --- 2.2.5 is pretty old. I recommend 2.4 at least for better results/experience -- it has some fixes for letter cases of the files -- Finder may show one spelling but Terminal another one (file name is the same but letter case will differ) -- this is enough to not to break.

0

Ciao Andriy, thank you.

In symfony 1.4, the application code is under the "/apps" folder, and the index.php is in the "/web" folder. I see that the breakpoint is in an unreachable place for PHPStorm, as the "/web/apps/" folder does not exist.

1) Yes, cause I can change that file and see the results in the browser. I think there was a mapping associated and I removed it now.

2) with xdebug_break() I get this error: "Remote file path '/Users/davide/Sites/davide/apps/frontend/modules/fthomepage/actions/actions.class.php' is not mapped to any file path in project" and can't debug properly.

3) now it stops in index.php just if I check the "Break at first line in the script" option - which is disabled now

4) I can try to update it

Here the new log:

Log opened at 2017-03-20 10:50:45
I: Connecting to configured address/port: davide.local:9009.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/davide/Sites/davide/web/index.php" language="PHP" protocol_version="1.0" appid="2555" idekey="PHPSTORM"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 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>

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

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Users/davide/Sites/davide/web/index.php" lineno="4"></xdebug:message></response>

<- breakpoint_set -i 6 -t line -f file:///Users/davide/Sites/davide/apps/frontend/modules/fthomepage/actions/actions.class.php -n 29
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="25550006"></response>

<- stack_get -i 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file:///Users/davide/Sites/davide/web/index.php" lineno="4"></stack></response>

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

<- run -i 9
Log closed at 2017-03-20 10:50:47

 

0

>2) with xdebug_break() I get this error: "Remote file path '/Users/davide/Sites/davide/apps/frontend/modules/fthomepage/actions/actions.class.php' is not mapped to any file path in project" and can't debug properly.

So .. find out why it's "not part of the project".

 

1) What is the project root folder (the folder that PhpStorm uses)?

2) What do you have at "Settings/Preferences | Languages & Frameworks | PHP | Servers" ?

Screenshots please.

I want to see a screenshot (whole IDE window) with the path to that file

I want to see how you have configured your "PHP | Server"

0

 

Man! It works now!
I just installed XDebug 2.4.1, restarted and tried again.
Probably it was something in the old XDebug version?

Davide

 

0

Please sign in to leave a comment.