New in 4.0: Support of PHP 5.4 Built-in Web Server

nnmatveev

As of PHP 5.4.0, the CLI SAPI provides a built-in web server which is intended for development purposes only. We are glad to announce that since PhpStorm 4.0 you can control a web server instance directly from the IDE.

To start working with the PHP built-in web server, first create a ‘PHP Built-in Web Server’ run configuration.

‘PHP Built-in Web Server’ run configuration

‘PHP Built-in Web Server’ run configuration editor

The “Host”, “Port”, and “Document root” fields are mandatory, the “Router script” field is optional. A ‘router script’ is a script which is run for each HTTP request. If this script returns ‘FALSE’ ,the requested resource is returned as-is. Otherwise the script’s output is returned to the browser.

Please see the official documentation for details.

Before launching the run configuration, make sure that that PHP interpreter, version 5.4 or higher is selected in your project settings.

Selected PHP interpreter version

Otherwise launching the run configuration fails.

Error message on attempt to run built-in web server using an incompatible PHP interpreter

Download the latest PhpStorm & WebStorm 4.0 EAP. We’d also love to get your feedback in the issue tracker

Develop with pleasure!

Comments below can no longer be edited.

5 Responses to New in 4.0: Support of PHP 5.4 Built-in Web Server

  1. Jason Rundell says:

    March 17, 2012

    So does the Built-in Web Server replace tools like WAMP/XAMPP/MAMP/Apache?

    • nnmatveev says:

      March 18, 2012

      WAMP/XAMP/MAMP – aren’t just web-servers. They also contain database/FTP and so on. Built-in Web Server could be a replacement for Apache only.

  2. Ivan Ivanov says:

    March 19, 2012

    What about the debugging with the built-in server ? Does phpstorm provide this feature ?

    • nnmatveev says:

      March 19, 2012

      Yes, but it is up to your PHP interpreter configuration. You need to configure Xdebug or Zend Debugger for your PHP CLI. Please note that only Xdebug 2.2RC1 is available for PHP5.4 now.

      • chankit says:

        April 10, 2012

        Xdebug 2.2RC1 works with PHP 5.4 in CLI, but apparently it won’t work when started with built-in web server, or PhpStorm 4 Beta doesn’t support it.