Built-in Webserver in PhpStorm

Ever since PhpStorm 6, we’ve had a built-in webserver which could serve up static content like HTML, JavaScript and CSS. With the latest version of the PhpStorm 7 EAP we have now added support for serving PHP from this webserver as well!

How does this work? It’s pretty easy! After opening a project in PhpStorm, navigate to http://localhost:63342/<projectname>. For example when working in a project called HelloWorld, navigate to http://localhost:63342/HelloWorld/. This URL will serve our project files using the project root as the webserver’s content root.

We have a short tutorial available with some more details on this feature.

Give PhpStorm 7 EAP a try. And as always, let us hear your thoughts in the issue tracker, through the comments below or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

This entry was posted in Cool Feature, Early Access Program and tagged , , , . Bookmark the permalink.

24 Responses to Built-in Webserver in PhpStorm

  1. Michal Suski says:

    How do I turn it off?

  2. Jannik says:

    I just tried it for fun with a symfony2 project: http://localhost:63342/Liim/web/app_dev.php (Liim is the name of the project).

    Result: 502 Bad Gateway

  3. Clint says:

    What, then, is the use of also creating a run configuration utilizing PHP 5.4+’s built in web-server if this is now available? Is it not redundant to setup a run configuration with PHP’s built in webserver if the fast-cgi version of PHP is running anyways and can’t be disabled? What are the pros/cons of each method? The documentation doesn’t cover the differences.

    • Maarten Balliauw says:

      Setting up a run configuration allows you to specify additional options your application may need. The built-in server uses the current PHP.ini but does not allow specifying additional runtime options. It also hosts your app under a directory and not at the root as opposed to the PHP-provided server.

  4. Clint says:

    What is the purpose of keeping the Fast-CGI executable running at all times without the ability to stop it?

    The run configuration PHP built-in webserver method allows us to easily stop the server between runs. So, why do we have an ability in one instance that we don’t have in the other? It seems a lot of people want it.

  5. Shahid says:

    Hi Jannik, i have figured out why are you having that problem. Well, all you need to do is to figure out your php interpreter. This could be done by following these simple steps:
    1- Open phpStorm.
    2- Go to File -> Settings -> php

    There you will have dialog, where on the very top of it, you can see the php language level (installed on your system will automatically be configured by phpStorm).

    3- In the next Interpreter combo list, you will look for the directory where your php folder resides like in my case it was: C:\xampp\php

    What it does is that it fetches the php.exe file from it which works as an interpreter for all the php code you write in your IDE.

    4- Press Apply button.

    Enjoy;-)

  6. Stophe says:

    Is it possible to change the port?

  7. John McCann says:

    How do I turn off the built in php server if I manage to get it stuck in an infinite loop!!!?

    The stop button doesn’t seem to work, I still get masses of output scrolling past.

  8. Sam says:

    I get the error:

    php-cgi not found
    Please ensure that configured PHP Interpreter built as CGI program (–enable-fastcgi was specified)

    Is there some easy way to do this? (I’m on Ubuntu)

    • Mikhail Vink says:

      phpinfo(); function, there is “Configure Command” to check that.

      • howdy says:

        I have also run into this same issue —

        php-cgi not found
        Please ensure that configured PHP Interpreter built as CGI program (–enable-fastcgi was specified)

        I do not have any enable fastcgi entries in my php.ini. What is the “Configure Command” you’re referring to?

      • howdy says:

        I’m also running on Ubuntu 12.04 and compared the phpinfo() listed on the page and my own. I don’t have a Configure Command field as listed above. Also, my “Server API” is “Apache 2.0 Handler” and not “CGI/Fast CGI” as listed in the Windows phpinfo() file at the top of the page.

  9. rearndt says:

    Let’s try asking Mr. Suski’s original question again :

    How do you turn this built-in server OFF?

    The operative word here is “OFF”. I did not purchase a license for this product to be dictated to about how to serve my pages.

    I hope this is not too difficult.

    Thanks.

    • Maarten Balliauw says:

      See http://youtrack.jetbrains.com/issue/WEB-9144 – it is not possible at the moment but you do not have to sue it. Working with your own prefered server is fine too.

      • Robert Arndt says:

        Thanks, Maarten. This was absolutely ZERO help. I really appreciate it.

        • Maarten Balliauw says:

          Hi Robert,

          You can still work with PHP’s built-in server, Apache, IIS or any other webserver. You do not have to use the built-in server, you are free to use whichever webserver you prefer.

          As for turning it off, that indeed is not possible at the moment. It is locked down to only accept connections from localhost by default, and not from the internal network.

          If you do feel turning it off completely, please continue the discussion at http://youtrack.jetbrains.com/issue/WEB-9144.

          Best regards,
          Maarten

  10. Bob Spero says:

    I tested this also and get 502 error as well on ubuntu 13.10

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>