Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making the php code execute in browser using PHPstorm

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!

like image 963
Ilya Karnaukhov Avatar asked Mar 27 '13 19:03

Ilya Karnaukhov


People also ask

How do I run a PHP file in browser?

If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.

Why PHP script is not running in browser?

PHP is not intended for execution in a browser. It is for web servers to execute, or other preprocessing on the PHP-installed computer. PHP runs in several incarnations when installed on a computer: from the command line.

How do I start PhpStorm?

To run PhpStorm, find it in the Windows Start menu or use the desktop shortcut. You can also run the launcher batch script or executable in the installation directory under bin. Run the PhpStorm app from the Applications directory, Launchpad, or Spotlight.


1 Answers

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.

like image 148
Ja͢ck Avatar answered Oct 02 '22 06:10

Ja͢ck