Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm does not sync with the server

Tags:

phpstorm

Here's the problem :

My project on phpStorm use a remote access to the server by FTP. When I save a modified file, the file is uploaded normally to the serv, but when I create a folder on the serv, i don't see it in phpStorm.

Any idea?

like image 895
Alex Avatar asked Oct 07 '14 08:10

Alex


People also ask

Where is remote host in PhpStorm?

Getting access to the Remote Host tool windowView | Tool Windows | Remote Host - the tool window can be accessed this way after you have opened it using the Tools | Deployment | Browse Remote Host command. The tool window is available only when the FTP/SFTP/WebDAV Connectivity bundled plugin is enabled.

Is not valid SFTP host is not specified?

The error happens when selecting the dev host after startup of PhpStorm. It only happens to the dev host. Clicking the Deployment settings button and clicking OK to close the box fixes the issue.

How do I connect to IntelliJ server?

Connect via SpaceLaunch IntelliJ IDEA. On the starting page, select JetBrains Space and click Connect to Space. Enter your organization URL and click Continue in Browser. In the browser window that opens, click Accept to grant the required permissions.


2 Answers

PhpStorm is built around "local project files are the main ones -- deployed are secondary" idea. It's natural to have "automatically upload to remote host" (sync local with remote) functionality to follow such an idea.

At the same time the IDE does not have anything to "automatically sync remote with local" (the reverse: to automatically copy remote stuff back to local). Simply because it contradicts such an idea: local files are the main ones.

Therefore:

The "Synchronize" button that you are referring to does not do what you are expecting it to do. It syncs what the IDE knows about project files on a local file system. In other words: it checks if there were any changes to local files done outside of the IDE. It does not do anything with remote files.

NOTE: In modern 202x.x versions it has been renamed to "Reload All from Disk" to avoid such a confusion).

To manually sync with remote files (any direction) you have these main options:

  • Use Remote Host side panel (can be accessed via Tools | Deployment | Browse Remote Host if it’s closed/hidden) and download any files or folders manually (drag and drop can also be used, just make sure that you are copying files because by default IDE tries to "move" (copy+delete) instead of just "copy"). It has a "Refresh" button to refresh the remote location.

  • Use two-way synchronisation (with preview) accessible via right click on desired folder(s)/files and choosing Deployment | Synch with Deployed... where you can sync those files/folders both ways (by default newer stuff will override older regardless of the direction).

The IDE can automatically sync one way (from local to remote): just ensure that automatic deployment is enabled and you have one server (or a group) marked as Default for this project.

Settings (Preferences on macOS) | Build, Execution, Deployment | Deployment | Options | Upload changed files automatically to the default server is the option. Check other options there to better suit your needs.

enter image description here

Please refer to the official help pages for more info on deployment (including a simple video tutorial): https://www.jetbrains.com/help/phpstorm/deploying-applications.html

like image 52
LazyOne Avatar answered Sep 30 '22 04:09

LazyOne


And the funny thing about it, it is not completly correct. The option underneath is missing.. 'skip external changes' should not be ticked. In Mac -> PHPStorm -> preferences -> Build, Execution, Deployment -> options Set the Upload as seen in the picture to always and make sure skip external changes is unticked.

like image 37
Collin Avatar answered Sep 30 '22 04:09

Collin