Configure PHPStorm 3 and Xampp

Dear All;

I'm a newbie with a PHPStorm so I need your help. Well I need to configure my phpstorm with xampp in local machine. What I need is to create a new project in phpstorm in desktop of my computer, at the same time should be also created in xampp my localserver, and when I add any new file to that folder should be also in xampp. In another words I need to mirror my folder in my local webserver. So any change happened to that folder should be happened in the folder of xampp.

Could I do that in PHPStorm ?

17 comments
Comment actions Permalink

Yes, you can:

1) Settings | Deployment -- create new entry of "Local or mounted folder" type, configure it and mark as default for this project
2) Settings | Deployment | Options -- make sure that "Upload changed files automatically to the default server" is active

Alternatively, you can try and create project directly from those files that are already in xampp ("In place" deployment type, so no additional file copying is required).

0
Comment actions Permalink

It gives that error !

Object Not Found .... Error 404

as I created that folder in desktop but I could not find it in xampp folder which is the webserver, not like netbeans which automatically asks for creating source and destination folder! what you said is working fine, but no mirror in xampp folder so it gives OBject not found error 404

0
Comment actions Permalink

Sorry, but I do not understand what is working fine and what does not:

  • PhpStorm does not copy files to destination ?
  • Maybe your xampp is not configured properly ?
  • etc


As far as I'm aware the PhpStorm part is working OK on my test machine so most likely it's misconfiguration on your end.

0
Comment actions Permalink

The procedure you mention about creating server and do right-click then choose open on browser is working fine.

What is not working no mirror in xampp. So when I run in browser it gives no object, that because the folder only in desktop no folders or files in xampp. In other words the phpstorm could not copy that folders and the all files in destination which should be the web server in may machine is http://localhost.

0
Comment actions Permalink

Well -- PhpStorm will copy only new & modified files/folders. If file was already in a project when such deployment type was created, then you have to either

  • manually copy all files over to xampp (only once, later PhpStorm should pickup and copy all changes when you click Save, obviously, as long as you have that "automatic" option checked)
  • or right click on root in Project View panel and choose Upload To YOUR_DEPLOYMENT_NAME
  • or you can use Tools | Deployment | Sync with Deployed to YOUR_DEPLOYMENT_NAME


And make sure that this Deployment is set as default for a project.

If you manually copy file from project into xampp, does it work ok when requesting via browser?

0
Comment actions Permalink

Well thanks a lot, you are really a problem solver. It's working fine.

To solve it. I did the following:

  1. Choose File -> Settings -> Deployment, from left panel
  2. In Right Panel I did the following
    • connection tap fill the following
      1. The name: I write localhost
      2. Type: Local or mounted folder
      3. upload/download project files: C:\xampp\htdocs\<Name of folder>
      4. In Web server root URL: http://localhost/<Name of folder>
    • mapping tap fill the following
      1. localpath: C:\Users\xxxxx\Desktop\phpstorm\<name of folder>
      2. depolyment path: \
      3. web path: \
  3. In File -> Settings -> Deployment -> Option
      1. Tick the Upload changed file automatically to the default server
      2. Upload External Change
  4. I copied the file manually, just only for the first time to the C:\xampp\htdocs\ folder.


Thanks again for your help now it's working fine thanks.

0
Comment actions Permalink

But should i repeat that for every new project?

0
Comment actions Permalink

Accordingly to your working settings in previous post  -- Yes.

However, if you alter them a bit, you will be able to share the same Deployment among different projects (obviously, you will need to alter such Deployment to match that particular project settings, but that is a very quick task).

You will need to change:

  • Connection tab (shared between projects): #3. upload/download project files: C:\xampp\htdocs -- no need for \<Name of folder> part here
  • Mapping tab (individual per project):
    • #1 - as is
    • #2 - depolyment path: \<Name of folder>
    • #3 - web path: \<Name of folder>


Try this and see if it works for you.

0
Comment actions Permalink

ok thanks.

I will do that for next project. Thanks a lot for your help.

0
Comment actions Permalink

Hi all,

many thanks for this post.
I'm excatly in the same case as L Q. and all these informations were really helpfull for me.

I just had two questions:
- Is it possible to launch the navigator from phpstorm ? I was not able to do this.
- I set up xdebug with out any prolbem, and it work fine since i can run step by step a code, but i would like to run the project directly on a web browser.
When i tried it, there is an error telling that debug server does not exist.
I go to the remote tab in the configuration => create a server :
- name
- host : localhost
- port 80
- debugger : xdebug
It does not work.
Moreover, when i repopen the remote tab, i see that server is not selected.
Any suggestions for this configurations ?

0
Comment actions Permalink

Hi Nicolas,

I'm not sure which "Remote tab" you're referring to -- I don't see any in v3 (unless I'm looking in a wrong place -- please show a screenshot).

To launch a site in a browser from PhpStorm you can do this:

  1. Run | Edit Configurations
  2. Create new configuration of "PHP Web Application" type
  3. Create new server (if you have none yet) or select existing one (all 3 fields must be filled: Name, Host, Port)
  4. Type your URL to launch & select which browser to use
  5. Once saved, you can find this new configuration on main toolbar in a drop-down box -- just select it and click Run.


Alternatively, you can right click (or via View menu) and choose "Open in Browser <FILE_NAME> on <YOUR_DEPLOYMENT_NAME>"

To debug -- you can use aforementioned "PHP Web Application" (you will have to issue stop/start debug/profiling command either via some browser extension or Bookmarklet or even passing appropriate command manually as part of URL) or use "PHP Remote Debug" run configuration -- they work a bit differently and have specific workflows/situations where one is better over another (you can read more in manual, in blog (check "debug" tagged articles) and a bit here).

0
Comment actions Permalink

Hi Andriy,

thanks, for your answer.
This was my first project.
From this fresh project in the context menu there were an input "Create Run Configuration"->"<project name> on server"
In the popup window there is a "remote tab" (first image)
I tried to create a server (second image)
After creation an error tells that no server are selected, but it is (third image).
If I reopen this window from the same way, the server is not selected.

Your previous answer help me to configure browser.
I still have to read the manual to configure PHP Remote Debug correctly.



Attachment(s):
02-01-2012 16-02-47.png
02-01-2012 16-00-57.png
02-01-2012 15-59-48.png
0
Comment actions Permalink

Hi Nicolas,

1. You are creating "PHPUnit on Server" run configuration type -- based on your original description this is wrong one -- better do it the way I have described (there you can choose whatever configuration type you want).

2. If from context menu -> Create Run Configuration you are seeing "<project name> on server" option, then you must be invoking it (context menu) on PHPUnit test file. If the file has NO relation to PHPUnit at all, then it must be a bug.

3. The "Server is not selected" message is referring to the first Server dropdown box (the one just below Name field) and not the one on Remote tab.

BTW -- what version of PhpStorm do you run exactly (Help | About -- there should be numbers like PS-111.150 or something similar) ?

0
Comment actions Permalink

Hi,

The version is 111.119

Sorry for the last answer, i made the scenario too fast because i re-do it for the screen shots.
As you can see in this pictures, there is no errors.
If click OK and re-open this popup, the debug server is no more selected.

As you mentionned in your point 2, I did not invoked it from a phpunit test file but from the project directory.

Many thanks for your help



Attachment(s):
02-01-2012 19-07-46.png
0
Comment actions Permalink

Hi Nicolas,

Instead of using "Create Run/Debug Configuration" all the time better use "Run | Edit Configurations" where you have full control over what you're doing. I suspect that you may have quite a few run configurations already if you have used "Create ..." all the time for the same file.

I think that availability of those Run Configuration types when right clicking on folder is not 100% correct as they should only be available on folders that contain PHPUnit test files or if folder is marked as Test Sources root (or its' subfolder) -- I shall file a ticket on this subject.

If you prefer right clicking -- do not use it on folder -- better use it on specific file (in Project View panel or in Editor itself).

0
Comment actions Permalink

Hi Andriy,

many thanks for all your answer.
I wil try now to configure properly my phpstorm, especially the PHP Remote Debug that i want to use.

0
Comment actions Permalink

Andriy,

Thanks for assistance!

I think that availability of those Run Configuration types when right clicking on folder is not 100% correct as they should only be available on folders that contain PHPUnit test files or if folder is marked as Test Sources root (or its' subfolder) -- I shall file a ticket on this subject.

I would be very appreciated you.

0

Please sign in to leave a comment.