PhpStorm comes with several ways of debugging PHP Web Applications. We can use zero-configuration debugging with Xdebug and with Zend Debugger. But next to that, there are also Run/Debug configurations we can use to debug our web applications with PhpStorm. In this tutorial, we'll see how we can create a Run/Debug configuration, the various types of Run/Debug configurations and when to use them.

Be sure to check the other tutorials about debugging PHP code with PhpStorm to learn more.


To debug PHP code with PhpStorm, we will need Xdebug or Zend Debugger. Make sure either Xdebug or Zend Debugger are installed and configured with PhpStorm.

1. Create a Run/Debug Configuration

Run/debug configurations define how a script or application can be executed and launched from the IDE. They are not required for debugging web applications (see zero-configuration debugging with Xdebug and with Zend Debugger), but come in handy for several scenarios.

Using the Run | Edit Configurations menu, we can add a new Run/Debug configuration clicking the green + button.

For PHP, there are several Run/Debug configuration types available. For web applications, these are the most interesting:

The other Run/Debug configuration types can be used for Debugging PHP CLI scripts with PhpStorm or Debugging and Profiling PHPUnit and Behat Tests with PhpStorm.

Each Run/Debug configuration comes with specific parameters that define how and where our application will run. Let's go over them.

PHP Built-in Web Server

The PHP Built-in Web Server configuration launches our application using PHP's built-in web server. It's perfect to quickly run (and debug) an application without having to configure a web server like Apache, Nginx or IIS. It just launches the application and handles HTTP requests to it.

The PHP Built-in Web Server configuration requires two main settings:

Optionally, a router script can be specified as well. Similar to URL rewriting, the web server will route all requests through the specified router script.

PHP Web Application

The PHP Web Application configuration lets us run our application using Apache, Nginx, IIS or another web server that runs on our own machine or remote. It is well-suited for running and debugging complete PHP web applications that need to run in a production-like setup.

For this configuration, we have to specify:

PHP HTTP Request

The PHP HTTP Request configuration executes a specific HTTP request against our application that runs either local or remote, on the PHP Built-in Web Server or on a real web server. It's a great configuration type to run and debug specific application scenarios (like requesting a product listing) and API calls when running REST API's.

For this configuration, we have to specify:

PHP Remote Debug

The PHP Remote Debug configuration will make the IDE await a debugger connection with specific IDE key or session id.

This run configuration is universal and can be used whenever other approaches are not applicable. However, we strongly recommend using the Start Listening for PHP Debug Connections mode instead.

For this configuration, we have to specify:

2. Debug!

From the toolbar, click the "bug" icon to start the debugger. We can also use the Run | Debug menu or the Shift+F9 keyboard shortcut (CMD+F9 on Mac OS X). This will launch the selected Run/Debug configuration and pauses execution at the first breakpoint.

We can now continue debugging as described in Using the PhpStorm Debugger.

When launching the debugger, PhpStorm appends a query string to the URL that is requested (for example This is a request variable that's required by Xdebug or Zend Debugger) to launch the debugger. The PhpStorm bookmarklets and Browser Debugging Extension do a similar thing when using zero-configuration debugging with Xdebug and with Zend Debugger.