PHP Built-In Web Server
This feature is supported in the Ultimate edition only.
The following is only valid when PHP Plugin is installed and enabled!
In this section:
- Enabling a built-in Web server
- Creating a run configuration of the type PHP Built-in Server
- Running a PHP application on a built-in Web server
Starting with version 5.4.0, PHP interpreters incorporate a Web server functionality. As soon as your project root folder or any other folder is declared the built-in Web server document root, all the files under this folder are submitted to the PHP interpreter for processing. All you need, is enable the built-in Web server in your project, create a run configuration of the type PHP Built-in Web server, and launch the application with this configuration.
Integration with the built-in Web server is supported in IntelliJ IDEA 11.1 and higher.
Enabling a built-in Web server
- Download PHP 5.4.0 or higher.
- Configure the downloaded PHP interpreter in IntelliJ IDEA.
- Open your project.
- Appoint the configured interpreter as default for use in the project.
Creating a run configuration of the type PHP Built-in Server
- Open the Run/Debug Configuration dialog box by doing one of the following:
- On the main menu, choose .
- Press Shift+Alt+F10, then press 0 to display the Edit Configuration dialog box or select the configuration from the pop-up window and press F4.
- Click on the toolbar or press Insert. From the drop-down list, select the PHP Built-in Web Server configuration type. The PHP Built-in Web Server dialog box opens.
- Specify the configuration name.
- Specify the server connection settings:
- In the Host text box, type
- Use the Port spin box to specify the port on which the built-in web server runs. By default this port is set to the default IntelliJ IDEA port
63342through which IntelliJ IDEA accepts connections from services. You can set the port number to any other value starting with 1024 and higher.
- In the Host text box, type
- Specify the folder that will be considered server document root. The folders that are under this document root in the project tree will be submitted to the PHP interpreter. The server document root folder will be accessed through HTTP at the above specified host:port.
In the Document root text box, specify the path to the relevant folder. This can be the project root or any other folder under it.
Optionally, customize the run configuration:
- To have a specific script always executed upon the server start-up, select the Use router script check box and specify the path to the script in the text box.
- To customize the behavior of the current PHP interpreter, in the Command Line area specify the options and arguments to be passed to the PHP executable file.
Running a PHP application on a built-in Web server
- Run the application. To do that, select the built-in Web server run configuration from the Run/Debug Configuration drop-down list on the main tool bar, and then click the Run button .
- Launch the browser of your choice and open the starting page of your application by typing its URL address in the following format:
http://localhost:<port>/<path to the required file relative to the server document root>