Beginner question : browser-debugging for files not in /Apps/MAMP/htdocs

I am using PhpStorm 8.0.3 with MAMP on my Yosemite Mac.
When I wish to view my web app without PhpStorm, I am obliged to put my project files in /Applications/MAMP/htdocs/

  If I do « command-line-only debugging »  with Phpstorm however, I have seen that I can  debug
a project located anywhere at all in my computer file hierarchy.

  My question is about « debugging from a browser » with PhpStorm. In that case, am I forced too  to put my project files in /Applications/MAMP/htdocs/, or is there a way to treat files located anywhere just like with « command-line-only debugging » ?

2 comments
Comment actions Permalink

Hi there,

You are not forced .. but this is the easiest way of doing it (as there is no need for extra configuring of your Apache and IDE -- many people (at lest among those who ask such questions) are failing to do this (new to PHP or coding overall)).

Many options available:

1) Keep your project anywhere you want .. but configure deployment in PhpStorm so it will copy your project into /MAMP/htdocs/myProject/ folder.

After that you will have to configure debugging path mappings (Preferences | Languages & Frameworks | PHP | Servers) so that IDE will know what file processed by PHP/xdebug corresponds to the one in your project (remember: you now have project in one place and actual website in another).

2) Same as above .. but no deployment at all. Just need to setup some symbolic link from /MAMP/htdocs/myProject/ to your actual project. Apache should handle this just fine (unless you have configured it to not to follow symbolic links)

3) Configure Apache so it uses separate virtual host for your site (so it will be available via separate domain name, e.g. "myproject.dev" which you can fake via hosts file or local DNS server if you have one). If you going this way .. you can tell Apache to serve files directly from another location where you project files are.


Some links:

0
Comment actions Permalink

  Solution 2 seems the most economic one (no need to copy project files and eat up disk space) and worked for me.

0

Please sign in to leave a comment.