PhpStorm
 
Get PhpStorm

Configure remote PHP interpreters

Last modified: 11 October 2024

A remote PHP interpreter is a PHP engine that is installed on a remote host or in a virtual environment. The term remote PHP interpreter is opposite to a local PHP interpreter that is installed on your local computer.

In PhpStorm, you can configure access to a remote PHP interpreter via SSH, in a Docker container, via Docker Compose, Vagrant, or WSL:

By using the SSH configuration type, you can access a PHP interpreter installed to a server on a remote host.

tip

Before you start
  • Make sure that the remote server is properly set up and running and has PHP installed to it.

  • Create an SSH connection configuration between PhpStorm and the remote server as described in Create SSH configurations.

Configure a PHP interpreter using SSH

  1. Press CtrlAlt0S to open settings and then select PHP.

  2. On the PHP page that opens, click the Browse button next to the CLI Interpreter list.

  3. In the CLI Interpreters dialog that opens, click the Add button in the left-hand pane, then choose From Docker, Vagrant, VM, WSL, Remote... from the popup menu.

    Select Remote PHP interpreter type
  4. In the Configure Remote PHP Interpreter dialog that opens, choose the SSH method and fill out the method parameters as follows:

    Remote interpreter via SSH dialog

    Field

    Description

    SSH configuration

    Choose one of the created SSH configurations from the list, or click the Browse button and create a new configuration as described in Create SSH configurations.

    PHP interpreter path

    Specify the location of the PHP executable file in accordance with the configuration of the selected remote development environment.

    • For remote hosts, PhpStorm by default suggests the /usr/bin/php location.

    To specify a different folder, click Open and choose the relevant folder in the dialog that opens. Note that the PHP home directory must be open for editing.

  5. Click OK. PhpStorm checks whether a PHP executable is actually stored in the folder specified in the PHP interpreter path field.

    • If no PHP executable is found, PhpStorm displays an error message asking you whether to continue searching or save the interpreter configuration anyway.

    • If the PHP executable is found, you return to the CLI Interpreters dialog where the installation folder and the detected version of the PHP interpreter are displayed.

    ps_php_remote_interpreter_ssh.png

    Clicking the Show phpinfo button next to the PHP executable field opens a separate information window with the installation details and the list of loaded extensions and configured options.

  6. Click Apply and OK to save the changes and return to the PHP settings page.

    Besides the configured remote PHP interpreter in the CLI Interpreter field, the PHP settings page will now display a read-only Path mappings field.

    Congiure path mappings

    Path mappings are used to set correspondence between the project folders, the folders on the server to copy project files to, and the URL addresses to access the copied data on the server.

    PhpStorm first attempts to retrieve path mappings itself by processing all the available application-level configurations. If PhpStorm finds the configurations with the same host as the one specified in the selected SSH configuration, the mappings from these configurations are merged automatically.

    If no configurations with this host are found, PhpStorm displays an error message informing you that path mappings are not configured.

    Click the Browse button in the Path mappings field and map local folders to the folders on the server manually. For details, see Configure custom mappings.