PhpStorm 2019.1 Help

Creating a Remote Server Configuration

A remote server is a server running on another computer (remote host). Files on the server are accessible via the FTP/SFTP/FTPS protocol.

To configure access to the server in this setup, you need to specify the following:

  1. Connection settings: server host, port, and user credentials.

  2. The server configuration root folder and the URL address to access it.

  3. Correspondence between the project root folder, the folder on the server to copy the data from the project root folder to, and the URL address to access the copied data on the server. This correspondence is called mapping.

Specify the name, type, and visibility of a server configuration

  1. Open the Deployment page by doing one of the following:

    • In the Settings/Preferences dialog (Ctrl+Alt+S), select Deployment under Build, Execution, Deployment.

    • Choose Tools | Deployment | Configuration on the main menu.

  2. In the left-hand pane that lists all the existing server configurations, click Add Add item and select the server configuration type depending on the protocol you are going to use to exchange the data with the server.

    • FTP: choose this option to have PhpStorm access the server via the FTP file transfer protocol.

    • SFTP: choose this option to have PhpStorm access the server via the SFTP file transfer protocol.

    • FTPS: choose this option to have PhpStorm access the server via the FTP file transfer protocol over SSL (the FTPS extension).

  3. In the Create new server dialog that opens, type the name of the server to be created and click OK. The Create new server dialog closes and you return to the Connection tab of the Deployment node.

    Click the Use as Default toolbar button the Use as default button to have PhpStorm silently apply the current configuration in the following cases:

  4. Use the Visible only for this project checkbox to configure the visibility of the server access configuration.

    • Select the checkbox to restrict the use of the configuration to the current project. Such configuration cannot be reused outside the current project. It does not appear in the list of available configurations in other projects. For example, if this checkbox is selected in an SFTP configuration, you cannot use its SSH credentials for configuring a remote interpreter.

    • When the checkbox is cleared, the configuration is visible in all PhpStorm projects. Its settings, including SSH credentials for SFTP servers, can be reused across several projects.

    For details on setting up interpreters, see Configuring Remote Node.js Interpreters and Configuring Remote PHP Interpreters for details.

Specify user credentials defined during registration on the host

  1. Specify the registration mode:

    • To login in a regular mode, specify the login in the User name field.

    • To enable anonymous access to the server with your email address as password, select the Login as anonymous checkbox.

  2. Specify the way to authenticate to the server:

    • For FTP server, type your password and select the Save password checkbox to have PhpStorm remember it.

    • For SFTP server, choose the way to authenticate to the server. Do one of the following:

      • Password: to access the host with a password. Specify the password, and select the Save password checkbox to save the password in PhpStorm.

      • Key pair (OpenSSH or PuTTY): to use SSH authentication with a key pair. To apply this authentication method, you must have a private key on the client machine and a public key on the remote server. PhpStorm supports private keys that are generated with the OpenSSH utility.

        Specify the path to the file where your private key is stored and type the passphrase (if any) in the corresponding fields. To have PhpStorm remember the passphrase, select the Save passphrase checkbox.

      • OpenSSH config and authentication agent: to use SSH keys that are managed by a credentials helper application (for example, Pageant on Windows or ssh-agent on Mac and Linux).

    • For FTPS server, specify your username and password. In the Advanced settings area, choose the security mechanism to apply.

      • Choose Explicit to have the explicit (active) security applied. Immediately after establishing connection, the FTP client on your machine sends a command to the server to establish secure control connection through the default FTP port.

        This method is selected by default.

      • Choose Implicit to have the implicit (passive) security applied. In this case, security is provided automatically upon establishing connection to the server which appoints a separate port for secure connections.

        Note that this method is considered deprecated, and using it is discouraged.

Enable connection to the server and specifying the server configuration root

  1. Specify the host name of the FTP/SFTP/FTPS server to exchange data with and the port at which this server listens.

    The default values are:

    • 21 for FTP and FTPS

    • 22 for SFTP

  2. In the Root path field, specify the server configuration root relative to the root folder on the server. This folder will be the highest one in the folder structure accessible through the current server configuration.

    Do one of the following:

    • Accept the default / path, which points at the root folder on the server.

    • Type the path manually.

    • Click Browse button and select the desired folder in the Choose Root Path dialog that opens.

    • Click the Autodetect button and have PhpStorm detect the user home folder settings on the FTP/SFTP server and set up the root path according to them. The button is only enabled when you have specified your credentials.

  3. In the Web server URL field, type the URL address to access the server configuration root. The server configuration root is the highest folder in the file tree on the local or remote server accessible through the server configuration. For in-place servers, it is the project root.

    Both the HTTP and the HTTPS protocols are supported.

  4. Click Open URL in browser icon in the field to make sure that the specified server root URL address is accessible and points at the correct Web page.

Map local folders to folders on the server and the URL addresses to access them

Configure mappings, that is, 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. The easiest way is to map the entire project root folder to a folder on the server. The project folder structure in this case will be repeated on the server, provided that you have selected the Create Empty directories checkbox in the Options dialog. For more details, see Configuring Synchronization with a Web Server and Customizing Upload/Download.

  1. Switch to the Mappings tab.

  2. In the Local Path field, specify the full path to the desired local folder. In the simplest case it is the project root.

  3. In the Deployment Path field, specify the folder on the server where PhpStorm will upload the data from the folder specified in the Local Path field. Type the path to the folder relative to the server configuration root.

    If the folder with the specified name does not exist yet, PhpStorm will create it, provided that you have selected the Create Empty directories checkbox in the Options dialog. For more details, see Customizing Upload/Download.

  4. In the Web Path field, type the path to the folder on the server relative to the server configuration root. Actually, type the relative path you typed in the Deployment Path field.

Overloading the deployment destination by configuring nested mappings

You can configure separate mappings for a specific folder under the your project root to have the contents of this folder synchronized with another location on the remote host.

Suppose you have configured the mappings as follows:

Local Path

Deployment Path

<project_root> ftp://.../htdocs/my_project
<project_root>/my_folder ftp://.../htdocs/my_folder
Then the files in your project will be uploaded as follows:

Local Path

Deployment Path

<project_root>/file1.php ftp://.../htdocs/my_project/file1.php
<project_root>/my_folder/file2.php

ftp://.../htdocs/my_folder/file2.php
instead of ftp://.../htdocs/my_project/my_folder/file2.php

Last modified: 26 July 2019

See Also