05 March 2012

How to Configure PHPStorm to Open Php Files in Your Browser in Localhost

How do you get PHPStorm to show your PHP files in your browser by clicking on the little browser icons in the right part of the window or right clicking and opening in your browser. PHPStorm doesn't just do this automatically. You have to configure it, and the configuration is entirely obvious. Here's what you have to do.

I'm assuming you have XAMPP or its equivalent installed and running on your machine. I'm also assuming you dumped your php files in the htdocs directory of XAMPP and that you can view your files in your browser just by typing the address using localhost/yourfile.php. And now you want to be able to open your files from within PHPStorm.

Here's what you do: 
1) go to the file > settings > deployment tab.
2) click default, and name it add Default to the name.
3) In the connection tag make it "In place".
4) Set the "Web server root URL" to http://localhost

5) go to the "Mappings" tab.
6) set the "Local path" to C:\xampp\htdocs\your_folder .
7) set the "web path on server "Default" to /your_folder/ .

Test to see if your file will now open in your browser. If not follow the instructions again. Notice if you start a project with a new directory under htdocs you will have to tell PHPStorm about this. To do so follow the steps again and in steps 6 and 7 above you will have to change the path to the location of your new subfolder of htdocs. This solution is just for Windows. Perhaps I will post a version for OS X if there's interest.


Anonymous said...

Very useful, thank you!

Tasnim said...

I love to read about your experiences! You write beautifully! I have enjoyed reading your articles. They are very well written. It looks like you spend a large amount of time and effort in writing the blog. I am appreciating your effort.

Anonymous said...


Thanks a lot for this post. I was stuck as to how to get phpStorm to communicate with localhost. Your article helped me immensely.

Thanks again

Richard C. Lambert said...

I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively.
dog liver detox

Kanye Co Jamila said...

I have read your blog its very attractive and impressive. I like it your blog.

PHP 7 Training in chennai | PHP 7 Training Course

PHP 7 Training in chennai | Online PHP 7 Course