To be able to run an application from PhpStorm, you first need to configure a PHP interpreter as described in Configure local PHP interpreters and Configure remote PHP interpreters. After that, you can do any of the following:
Switch between configured PHP interpreters on the fly
Press Ctrl+Shift+A and start typing
Change PHP interpreter. In the suggestions list, select the Change PHP interpreter action.
If necessary, you can assign a keyboard shortcut for this action either directly in the suggestions list by pressing Alt+Enter, or at a later point as described in Configure keyboard shortcuts.
The selected interpreter will be set as the default project interpreter on the PHP page of the Settings/Preferences dialog (Ctrl+Alt+S). This will also affect the run/debug configurations, test frameworks', and quality tools' configurations that are set to use the default project interpreter.
Run a single script
If you are not going to pass any parameters to your program, and your program does not require any specific actions to be performed before start, you can run it right from the editor.
Right-click in the code editor, select Run from the context menu, and then select <script name> from the submenu.
To run a script, open it in the editor or select it in the Project tool window, and then select Run <script file name> from the context menu.
PhpStorm creates a temporary run/debug configuration of the type Node.js.
The script will run, and a temporary run/debug configuration will be created for it.
Use a run/debug configuration
If you are going to pass parameters to your program or otherwise customize the startup of your program, use a run/debug configuration.
On the main toolbar, select the run/debug configuration you are going to use.
Click or press Shift+F10.
Alternatively, press Alt+Shift+F10, select the desired run configuration from the list, and press Enter.
When the application starts, you can view its output and interact with it in the Run tool window. Every run/debug configuration creates a separate tab when you run it.
To learn more about tool windows and how to manage them, see the Tool windows topic.
Open a file in a web browser
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.
To open a file that is intended to be rendered by a web browser (HTML, XML, JSP, and so on), do one of the following:
Right-click a file and select Open in Browser.
From the main menu, select View | Open in Browser.
Use the browser popup in the top right part of the editor window. Click the browser button to open the web server file URL, or Shift+Click it to open the local file URL.
The Open in Browser action is not available for other file types. However, you can still execute it using Find Action Ctrl+Shift+A.
On the toolbar of the Run tool window, click or press Shift+F10
Stop and pause applications
When you stop a program, its process is interrupted and exits immediately. When you pause a program, it continues running in the background, but its output is suspended.
Stop a program
In the Run tool window, click on the toolbar. Alternatively, press Ctrl+F2 and select the process to stop.
Pause a program
Right-click in the Run tool window and select Pause Output from the context menu. Use the same toggle to resume the program.
Show running processes
You can view the list of all active run or debug sessions and navigate between them.
From the main menu, select Run | Show Running List. In the top-right corner of the editor, PhpStorm shows a list with all active applications.