7
votes

So PHPstorm is running the php code fine in its console when I click run, that's great but I want to see it in the browser.

So I created a new PHP web application inside PHPstorm, set up the server to "localhost:8000".

PHPstorm screenie

Now when I click RUN it opens the browser but I get an error message: "Oops! Google Chrome could not connect to localhost:8000"

What am I doing wrong??

Thanks!

1
Do you have a web server running listening to that port? - datasage
If you using PHP 5.4, it has built-in web server .. and PhpStorm supports it as well (use PHP Built-in Web Server type of configuration). More details on built-in server functionality: php.net/manual/en/features.commandline.webserver.php - LazyOne
Small blog post about built-in 5.4 web server support in PhpStorm: blog.jetbrains.com/webide/2012/03/… - LazyOne
@LazyOne maybe you should write up those comments as an answer so that this question can be marked 'answered' - thaJeztah
Guys so I tried using PHP's built in server thingy, I also tried to initialize the PHP server through the terminal, it says that the server is initialized and listening to the localhost:8000... But still no success, chrome is still telling me there's nothing there, any ideas? - Ilya Karnaukhov

1 Answers

3
votes

You have to configure a run configuration for your project first.

Go to Run -> Edit Configurations, click on "PHP Built-in Web Server" and then press "+". You should see something like this:

Run/Debug Configurations

After saving the settings you can run the web server via Run -> Run '<project-name>'. It should now serve up the pages to your browser.