PhpStorm 2019.1 Help

Built-In Web Server

PhpStorm has a built-in web server that can be used to preview and debug your application. This server is always running and does not require any manual configuration. All the project files are served on the built-in server with the root URL http://localhost:<built-in server port>/<project root>, with respect to the project structure.

The built in server can only serve static content like HTML, JavaScript and CSS. To use it with PHP files, you need a local PHP interpreter specified for your project. When the interpreter is configured, PhpStorm will automatically start the PHP Built-In Web Server and redirect all PHP requests to it as soon as you run your PHP application. To run your PHP application, either open a file in the browser or create a dedicated run/debug configuration and launch it.

Configuring the built-in web server

If necessary, you can customize the parameters of the built-in web server. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for macOS, and click Debugger under Build, Execution, Deployment.

Item

Description

Port

Use this spin box to specify the port on which the built-in web server runs. By default this port is set to port 63342 through which PhpStorm accepts connections from services. You can set the port number to any other value starting with 1024 and higher.

Can accept external connections

If this checkbox is selected, then the files on the built-in server running on the specified port are accessible from another computer.
If this checkbox is cleared (by default), then the debugger listens only to local connections.

Allow unsigned requests

For security reasons, any request to a page on the built-in server from outside PhpStorm is by default rejected and the following authorization popup is displayed:
debugger_allow_unsigned_requests.png
To access the requested page, click Copy authorization URL to clipboard and paste the generated token in the address bar of the browser.

However this behaviour may be annoying, for example, it may block your debugging session if manual intervention is impossible. To suppress displaying the authorization popup, select the Allow unsigned requests checkbox.

Opening a file in the browser

Do one of the following:
  • Choose View | Open in Browser from the main menu or press Alt+F2. Then select the desired browser from the list.

  • Hover your mouse pointer over the code to show the browser icons bar: the bar with the icons of configured browsers Click the icon that indicates the desired browser.

Note that if a Deployment server is defined for this project and marked as default, the file will be served from this server instead. If necessary, you can still open the page via the PhpStorm built-in web server. To do this, open the desired browser and type the URL of the file with respect to the project structure, using http://localhost:<built-in server port>/<project root> as the root URL.

Last modified: 26 July 2019

See Also