Setting up phpStorm with MAMP - Workflow for local development

I've just purchased a license for phpStorm. Mainly because I think the editor is state of the art, BUT.
Using IDE's like Coda it is much simpler to get the whole workflow of creating a project, adding some code and run it in a browser on Apache on localhost going.

I'm a bit confused about where to configure what. It should be easy to create a PHP/Web project and just hit a shortcut to run the page in a browser through localhost.
I'm having difficulities setting up this workflow in phpStorm.

I have my webroot in /Users/chris/Sites and create projects within that directory.
I would like to just be able to "run" the project with a shortcut so it would appear in my default browser as a web application, not as a console php script.

What would be the correct way of defining "localhost" to be the default webserver and how would I go about configuring phpStorm to have a keyboard shortcut to launch the project/file in my default browser?

I miss a feature to select via a dropdown the browser to use and launch via "localhost" without any debugging or anything, just a simple way to "run" the project.

In Coda everything "just works" after creating a site and launching the preferred browser via the IDE.

Comment actions Permalink

Hi Chris,

You have to define a Deployment entry and mark one as Default for this particular project (Settings | Deployment). In your case (where everything is already in place) you should use "In place" entry type.

The you can use "View | Web Preview" to open current file in browser (available browsers are defined in Settings | Web Browsers). The same can be achieved when clicking on appropriate browser icon on small semi-transparent popup that appears in right top corner of the editor after a some delay.

Without this you will not be able to properly open any page in browser (I mean -- with proper URL, not like full physical path).

If you want to use Run functionality, then go "Run | Edit Configurations" and create one of the "PHP Web Application" type -- it will be for specific page (every time it will be opening that page regardless of what file is currently active) and specify the browser as well. But that requires a bit more configuration ("Server" combobox) as, as name suggests ("Run/Debug Configuration"), it mainly used for debugging (at least in PhpStorm).

Comment actions Permalink

I still feel that this is kinda cumbersome. Should be possible to define a standard server at the IDE level, that every PHP project inherits with a possible "local/in place" as default.
That way I would not have to define new settings for every project as I only do local development on this machine.

Comment actions Permalink

Maybe -- the Deployment entry itself is shared between all projects (the first tab), but the 2nd, 3rd etc tabs are project-specific.

So .. depending on what URLs you are suing for each project, you should be able to use the same entry, but provide this project-specific paths (and you still have to mark it as Default for each project). If you can provide few pairs of "URL in browser" => "Physical path on disk" (2 should be enough) I can tell you what can be done here.

But in any case -- there is no single setting that will work for ALL projects straight away (without some small changes) in this regard.

Comment actions Permalink


Thanks for assistance!:)


Please sign in to leave a comment.