Debug: Mapping on local server MVC frameworks

I'm jumping into the fray on the latest and greatest 102.18 debug fun.  I've been reading all of the threads and blog posts on debugging and I'm still unable to make it work, since about the 98 series.  I'm running a local copy of apache, and my project root and web root are one and the same.

At the moment, I can listen to and receive requests from my browser to the PhpStorm IDE.  The requests show up as tabs in my debug pane, with the proper output, and it briefly rolls through index.php and then disconnects the debugger.  My code with the breakpoints, while it does run, doesn't break.  If I put a breakpoint in index.php, I end up with a mapping error that reads a bit strange:

Cannot find a local copy of the file on server /Users/me/project/www/index.php
Local path is /Users/me/project/Users/me/project/www/index.php

Notice the double pathing?  I've edited the mappings to both specify index.php explicitly, and to simply add my project root as /, and neither fixes the problem.  If I remove the mapping altogether, the breakpoint in index.php stops working as well.  

I feel certain this is a mapping issue with my configuration, but I could use some assistance in working out the details.  Do you have any hints?

3 comments

Ok, wow.  I just got it.

When I was in the mappings panel, I saw two columns: File/Directory and Path on server.

The File/Directory was pointing to the files within the PHPStorm project, and the Path on server was, I thought, the path relative to my http root.

I was wrong.

The Path on Server is the location of the file on my filesystem.  So, I took the project root in the mapping dialog and told it where it was on the filesystem, and voila, I can debug!  It looks a little odd, but it works.

Here's a text representation of what I've done:

Path Mappings

File/Directory                  Path on Server
/Users/me/project          /Users/me/project


Silly looking, but what do I care, it works.  Hope this thread helps some folks.

0

There are a couple of other usability issues related to setting up local servers on OS X.  PhpStorm forces you to set the link to the PHP bin every time for each project.  Also, the main "Run" dropdown menu has two "Run" and "Debug" options but it isn't clear why they are different, and why sometimes only one is available.  Finally, I haven't been able to preview pages in browsers -- MAMP apache is working and I can get to the page directly through a browser, but the preview in browsers menu doesn't appear in phpStorm.

0

Hello ChrisK0,

PhpStorm forces you to set the link to the PHP bin every time for each project.

I created an issue for that. Please vote - http://youtrack.jetbrains.net/issue/WI-4627

Also, the main "Run" dropdown menu has two "Run" and "Debug" options but it isn't clear why they are different,

'Run' for simple executing of script and 'Debug' for executing script under one of the supported by PhpStorm debug extensions - XDebug or Zend Debugger. Running a script under debug allows you to set breakpoints and get script stopped on them.

and why sometimes only one is available

Maybe it relates to http://youtrack.jetbrains.net/issue/WI-4547. This issue is fixed. Feel free to create a bug request in our tracker http://youtrack.jetbrains.net/issues/WI if you know about other cases.

Finally, I haven't been able to preview pages in browsers -- MAMP apache is working and I can get to the page directly through a browser, but the preview in browsers menu doesn't appear in phpStorm.

You should configure at least one deployment server and mark it as default. Then the action "open in Browser" become available for you.

Thank you for feedback!

0

Please sign in to leave a comment.