What's a standard developing/programming process for PHPStorm?

Please forgive me -- I have been poring over the online help sections and discussion forums for hours... all night, even! I've also been asking for help on StackOverflow. But for the life of me, I just can't wrap my head around the process of development in PHPStorm.


I know no one likes a loaded question, and so I was going  to break this down into separate questions, but my head is just swirling  from trying to a get a working grip on multiple subjects in PHPStorm:

1. I'm a bit overwhelmed on the notion of running PHP code you've just written vs. running a "Run Configuration", and why it always defaults to treating it as a script (and not a browsable web page, if you want)
2. I'm confused as to when/why "Deployment" comes into play and should be used in projects, as it seems critical to being able to use xdebug.
3. I have trouble working out how/when/why files are mapped here/there/locally/server-side/relative/absolute/etc. What methods do developers typically use in different scenarios (like using a locally installed server on their machine)?

I have PHPStorm 4. I have a local Apache server running on my machine. I have PHP 5.3 installed, with the Xdebug extension.

My goal is to be able to create a project, create a PHP file within that project, write some code, and then click "Run" or "Debug", and have that PHP file loaded up in an external browser automatically from the IE. I understand, however, that that process must be done with some different/extra steps... but how? Up until using PHPStorm, I was just saving the PHP file from Notepad++ into the actual physical directory of where it's stored in the server (wwwdocs), and then having to continuously refresh the web page manually in my browser.

In PHPStorm, I never have the option to "Open in browser" for any of the PHP files I create. I try to create a PHP Web Page run configuration, but I don't understand the "Start URL" setting -- does that mean that I have to literally write the full URL for where that specific PHP file is on the local Apache server? Do I have to do this for _every_ PHP file that I want to run/debug on my Apache server?

I'm hoping that there is some type of setup or defaults that I can do so that I can create a new project and have it configured or mapped to be able to set it up correctly, so that I don't have to keep editing server/file mappings and locations for every project, just to be able to debug a PHP file on a browser.

Is there any hope, or am I out of luck in that department? :)

3 comments
Comment actions Permalink

There is a bunch of stuff in your question I just don't know/use.  I hardly ever need to touch the "Run Configurations"  or the "File mappings"  as it all seams to be handled automatically.

Here is a breif description of my setup and what I do to initialize it and work on something.

Usually for me i have an online production version of the site and a copy of that same site on a local server.  the local server is on the same network and xdebug is installed.  Also it runs ehcp.net as a control panel.

I usually work on a CMS system called Jamroom  (jamroom.net) so there is the normal setup of installing it before fiddling/changing stuff starts.  Its a web install so for me I initially upload the .zip file to the production server and un-zip it there as its faster.

Once all the CMS system's files are on the production server, i create the database and run the install script from a web browser.  The CMS system is now live on the net.

I open PhpStorm and it will normally have some existing project open up with it.  I click on FILE and OPEN DIRECTORY.  From the OPEN DIRECTORY menu I create a new directory in the folder I use for all my phpstorm projects /home/me/PhpStorm_projects/the-new-site.com

This now shows me PhpStorm with a blank interface.  there is nothing in the project panel, nothing in the editor and nothing in the remote hosts panel.

The first step from here is to open the TOOLS -> DEPLOYMENT -> CONFIGURATION dialog and add the info for the remote host of the production server.  Change to the mappings tab and select USE THIS SERVER AS DEFAULT and put /  and  / in as the paths to map the servers web root to the local folder just created.

Then open the REMOTE HOST panel (on the right) and click either DOWNLOAD FROM HERE or SYNC WITH LOCAL to bring all the production servers folders down to the local machine.

Now local matches the remote production.

Next step (for me) is to add my local dev machine.  so its back to TOOLS -> DEPLOYMENT -> CONFIGURATION and add another server, this time my local machine.  I use an extention of something so that I know which is which.

If im working on some-site-name.com  then i will create some-site-name.iixxii.cc  so that it is obvious which is production and which is local.  I change my /etc/hosts file to add some-site-name.iixxii.cc to it so that from this machine that URL points to a local IP address.

Next I upload my local copy that I have just downloaded up into the root of some-site-name.iixxii.cc .

I go back to TOOLS -> DEPLOYMENT -> CONFIGURATION and set the local server as the default.  then go to TOOLS -> DEPLOYMENT  and check (Automatic Uploads).

I now have a setup where anything i change on my local machine will be automatically uploaded to my local dev server.

The following thing i do is to initialize git.  you can do that from VCS -> ENABLE  VERSION CONTROL INTEGRATION and choose GIT.

This will add another panel to the footer bar 'Changes'

before you commit everything, locate something in the /.idea/xxxxxx... directory and right click on it.  chose to ignore the entire directory.

now commit everything.

Everything in the 'Changes' panel will dissappear.  It will be empty.

From here development starts.

Change what you need to change, it will be automatically uploaded to your local server.  view it in a browser.  When you are happy with all the changes you will see all the files that you have changed in the 'changes' panel.  right click the folder and select "Upload to..." and choose your production server.  This will  upload all your changes to the production server.  then commit them to git to clear your change panel. (right click and select COMMIT CHANGES).

Continue making changes as much as you like.

When you get stuck and want to debug something.  Put a break point in the margin of the file that you want to stop at and click the little red telephone icon in the tool bar.  This will turn the debug listener on.  If xdebug is working correctly PhpStorm will popup a dialbog saying "do you want to accept this incoming connection"  you click ACCEPT and if the breakpoint is within the path that is called it should stop at the break point.  You will see all of the vars as they are at that section.  F7 to go into a function F8 to step one line F9 to let it run to the next break point.

hope thats useful.

0
Comment actions Permalink

I too am having trouble setting up XAMP with phpstorm on Windows 7.

Is there a step by step guide available we all can refer to?

I read the phpstorm help topics, I searched the web but still couldn't find something to follow along. Most of them refer to setting up xdebug AFTER you have setup xamp with phpstorm. All the topics on this forum are too unambiguous to the poster's problem. Configuring run configuration, servers and interpreters are not mentioned in the help topics.

0
Comment actions Permalink

xdebug is something that will run on a server. so yes you need to install the server first, then install xdebug after you have installed the server.

here is one step by step install process:
https://ruzdi.wordpress.com/2010/08/17/simple-steps-to-installing-xdebug-on-ubuntu/

I personally like xdebug running on ubuntu server on a separate local machine and use ehcp (ehcp.net) to control the domains.

Everyones setup is going to be different so you just need to work step-by-step to get your setup working.

0

Please sign in to leave a comment.