IntelliJ IDEA 14.1.0 Help

Configuring Remote PHP Interpreters

The term remote PHP interpreter denotes a PHP engine installed on a remote host or in a virtual environment set up in a Vagrant instance. The term remote PHP interpreter is used opposite to local PHP interpreters that are installed on your computer, see Configuring Local PHP Interpreters.

You can to access a remote PHP interpreter in three ways:

  • Using SSH credentials to access the host where the PHP interpreter is installed.
  • Through access to the corresponding Vagrant instance.
  • According to a Server Access Configuration. This approach is also helpful if you are going to synchronize your project sources with the Web server on the target remote host.

On this page:

Configuring a Remote PHP Interpreter on a Host Accessible through SSH Connection

Before you start:

  1. Configure access to an ssh server on the target remote host and make sure this server is running.
  2. Make sure the PHP Remote Interpreter repository plugin is installed and enabled as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

Configuring a PHP interpreter using SSH credentials

  1. Open the Settings dialog box by choosing File | Settings, then click PHP under Languages & Frameworks. The PHP page opens.
  2. On the PHP page that opens, click the browseButton button next to the Interpreter drop-down list in the Development environment section.
  3. In the Interpreters dialog box that opens, click the Add toolbar button add   in the left-hand pane, then choose Remote on the context menu.
  4. In the Configure Remote PHP Interpreter dialog box that opens, choose the SSH Credentials method.
  5. Specify the name of the remote host and the port which the SSH server listens to. The default port number is 22.
  6. Specify your credentials to access the remote host in accordance with the credentials received during the registration on the server. Type your user name and choose the authentication method:
    • To access the host through a password, choose Password from the Auth type drop-down list and type the password.
    • To access the host through a pair of SSH keys, choose Key pair, then specify the path to the file where your private key is stored or the passphrase if you have configured it during the generation of the key pair.
  7. Specify the location of the PHP executable file in accordance with the PHP development environment configured on the selected remote host. By default IntelliJ IDEA suggests the ust/bin/php folder. To specify another folder, click the Browse button browseButton and choose the relevant folder in the dialog box that opens.
  8. When you click OK, IntelliJ IDEA checks whether the PHP executable is actually stored in the specified folder.
    • If no PHP executable is found, IntelliJ IDEA 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 Interpreters where the installation folder and the detected version of the PHP interpreter are displayed in the General area.
    ps_php_remote_interpreter_ssh.png
  9. Optionally, customize the configuration settings of the installation in the Advanced area. In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the php.ini file. To do that, click the Browse button browseButton.png next to the Configuration options field, and then create a list of entries in the Configuration Directives dialog box, that opens.
    • To add a new entry, click the Add button add.png. In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.

      You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.

    • To delete an entry, select it in the list and click the Remove button delete.png.
    • To change the order of entries, use the Up arrowUp.png  and Down arrowDown.png buttons.

    Upon clicking OK, you return to the Interpreters dialog box, where the entries are transformed into a command line.

Configuring a Remote PHP Interpreter in a Vagrant Environment Instance

Before you start

  1. Make sure that Vagrant and Oracle's VirtualBox are downloaded, installed, and configured on your computer as described in Working with Reproducible Development Environments Using Vagrant.
  2. Install and enable the Vagrant plugin as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

    The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins. Once enabled, the plugin is available at the IDE level, that is, you can use it in all your IntelliJ IDEA projects.

  3. Make sure that the parent folders of the following executable files are added to the system PATH variable:
    • vagrant.bat or vagrant from your Vagrant installation. This should be done automatically by the Vagrant installer.
    • VBoxManage.exe or VBoxManage from your Oracle's VirtualBox installation.
  4. Configure the PHP development environment in the Vagrant instance to be used. You can do it in many ways, one of them is to choose Tools | Start SSH session on the main menu and in the embedded terminal that opens type the following command:
    sudo update sudo apt-get install php5-common libapache2-mod-php5 php5-cli

Learn more about using Vagrant with IntelliJ IDEA in Working with Reproducible Development Environments Using Vagrant.

Configuring a PHP interpreter in a Vagrant instance

  1. Open the Settings dialog box by choosing File | Settings, then click PHP under Languages & Frameworks. The PHP page opens.
  2. On the PHP page that opens, click the browseButton button next to the Interpreter drop-down list in the Development environment section.
  3. In the Interpreters dialog box that opens, click the Add toolbar button add   in the left-hand pane, then choose Remote on the context menu.
  4. In the Configure Remote PHP Interpreter dialog box that opens, choose the Vagrant method.
  5. Specify the Vagrant instance folder which points at the environment you are going to use. Technically, it is the folder where the VagrantFile configuration file for the desired environment is located. Based on this setting, IntelliJ IDEA detects the Vagrant host and shows it as a link in the Vagrant Host URL field.
  6. Specify the location of the PHP executable file in accordance with the PHP development environment configured in the selected Vagrant instance. By default IntelliJ IDEA suggests the ust/bin/php folder. To specify another folder, click the Browse button browseButton and choose the relevant folder in the dialog box that opens.
  7. When you click OK, IntelliJ IDEA checks whether the PHP executable is actually stored in the specified folder.
    • If no PHP executable is found, IntelliJ IDEA 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 Interpreters where the installation folder and the detected version of the PHP interpreter are displayed in the General area.
    ps_remote_intrpreter_vagrant.png
  8. Optionally, customize the configuration settings of the installation in the Advanced area. In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the php.ini file. To do that, click the Browse button browseButton.png next to the Configuration options field, and then create a list of entries in the Configuration Directives dialog box, that opens.
    • To add a new entry, click the Add button add.png. In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.

      You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.

    • To delete an entry, select it in the list and click the Remove button delete.png.
    • To change the order of entries, use the Up arrowUp.png  and Down arrowDown.png buttons.

    Upon clicking OK, you return to the Interpreters dialog box, where the entries are transformed into a command line.

Configuring a Remote PHP Interpreter on a Remote Host accessible through SFTP

Before you start:

  1. Make sure a ssh server is running on the target remote host and you have configured access to it.
  2. Make sure the Remote Hosts Access plugin is enabled. The plugin is bundled with IntelliJ IDEA and activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings dialog box as described in Enabling and Disabling Plugins.
  3. Create a server access configuration of the type SFTP to establish access to the target host as described in Creating a Remote Server Configuration.

To configure a PHP interpreter using SSH credentials:

  1. Open the Settings dialog box by choosing File | Settings, then click PHP under Languages & Frameworks. The PHP page opens.
  2. On the PHP page that opens, click the browseButton button next to the Interpreter drop-down list in the Development environment section.
  3. In the Interpreters dialog box that opens, click the Add toolbar button add   in the left-hand pane, then choose Remote on the context menu.
  4. In the Configure Remote PHP Interpreter dialog box that opens, choose the Deployment Configuration method.
  5. From the Deployment Configuration drop-down list, choose the server access configuration of the type SFTP according to which you want IntelliJ IDEA to connect to the target host. If the settings specified in the chosen configuration ensure successful connection, IntelliJ IDEA displays the URL address of the target host as a link in the Deployment Host URL field.
  6. Specify the location of the PHP executable file in accordance with the PHP development environment configured on the selected remote host. By default IntelliJ IDEA suggests the ust/bin/php folder. To specify another folder, click the Browse button browseButton and choose the relevant folder in the dialog box that opens.
  7. When you click OK, IntelliJ IDEA checks whether the PHP executable is actually stored in the specified folder.
    • If no PHP executable is found, IntelliJ IDEA 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 Interpreters where the installation folder and the detected version of the PHP interpreter are displayed in the General area.
  8. Optionally, customize the configuration settings of the installation in the Advanced area. In the Configuration options field, compose a string of configuration directives to be passed through the -d command line option and thus add new entries to the php.ini file. To do that, click the Browse button browseButton.png next to the Configuration options field, and then create a list of entries in the Configuration Directives dialog box, that opens.
    • To add a new entry, click the Add button add.png. In the new line, that is added to the list, specify the name of the new entry and its value in the Name and Value text boxes respectively.

      You can add as many entries as you need, just keep in mind that they will be transformed into a command line with its length limited to 256 characters.

    • To delete an entry, select it in the list and click the Remove button delete.png.
    • To change the order of entries, use the Up arrowUp.png  and Down arrowDown.png buttons.

    Upon clicking OK, you return to the Interpreters dialog box, where the entries are transformed into a command line.

  9. Click the Show phpinfo button to have IntelliJ IDEA display a separate information window where you can examine the installation details and view the list of loaded extension and configured options. Please note that the options specified in the Configuration Options field of the Interpreters dialog box are not listed.

See Also

Last modified: 14 July 2015