PhpStorm does not sync with the server

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.


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

Tags:

Phpstorm