By default, the Local path field contains the path to the project root. However, you can select any other directory within your project tree. Let's use the default path.
In the Deployment path field (which is by default empty), specify the folder on your server where PhpStorm will upload data from the folder specified in the Local path field.
In this example, it's Application. This path is specified relative to the web server root folder, which is Users/jetbrains/deployment.
Leave the default / value for Web path.
After you apply the changes, the server is ready to use.
Browse remote hosts
To make sure your server is up and running, select Tools | Deployment | Browse Remote Host in the main menu, and the Remote Host tool window appears on the right of the PhpStorm window:
Deploy files
Upload a file to the server
First, let's upload one of the files to the remote server.
In the Project tool window (Alt01), right-click the file you want to upload. In our case, this is the README.md file.
From the context menu, select Deployment | Upload to MyRemoteServer, confirm the upload, and see the upload results.
You can also upload the contents of each directory within your project. Right-click the directory you want to upload in the Project tool window and select Deployment | Upload to MyRemoteServer.
Compare remote and local versions
There is a local and a remote copy of the README.md file, and they are identical. Modify the local version.
In the Remote Host tool window tool window, right-click README.md and select Compare with Local Version. PhpStorm opens the Diff Viewer.
Download the file from the server
In the Remote Host tool window tool window, right-click the README.md file and select Download from here. PhpStorm shows a warning.
Click Yes.
You can also download an entire directory if it has been previously uploaded to the server.
Synchronize the changes
Undo the changes in the README.md file by pressing Ctrl0Z.
Click the README.md file and from the main menu, select Tools | Deployment | Sync with Deployed to MyRemoteServer.
PhpStorm shows the Diff Viewer where you can accept individual changes or reject them.
Automatically upload files to the default server
When you need to have the exact same files on the server as in a PhpStorm project, automatic upload can be helpful. Automatic upload means that whenever a change occurs in the IDE, it will be deployed to the default deployment server.
A deployment server is considered default if its settings apply by default during automatic upload of changed files.
Define the default server
Press CtrlAlt0S to open settings and then select Build, Execution, Deployment | Deployment.
Alternatively, go to Tools | Deployment | Configuration in the main menu.
From the list of servers, select the one you want to make default and click on the toolbar above the list of servers.
tip
You can also click the Default Deployment Server widget in the PhpStorm status bar and select the desired server or server group from the popup menu.
Enable automatic upload
As soon as the default server is set, you can make upload to this server automatic.
Press CtrlAlt0S to open settings and then select Deployment | Options.
Alternatively, go to Tools | Deployment | Options in the main menu.
From the Upload changed files automatically to the default server drop-down list, select one of the following options:
Always: upload a file upon every automatic and explicit save.
tip
You can also enable this option in Tools | Deployment | Automatic Upload in the main menu.
On explicit save action: upload a file after save only if this save was invoked manually by choosing File | Save All or pressing Ctrl0S.
The Always mode is not recommended for deploying to production: incomplete code can be uploaded while developing, potentially breaking the production application.
Upload external changes
By default, PhpStorm also uploads the files if they are changed by some external process, such as a VCS branch change, compilation of SASS or LESS, or a File Watcher. To change this behavior and skip external changes, set Upload changed files to the default server to Always and select the Skip external changes checkbox:
Summary
You've passed this very basic tutorial and performed the following tasks: