Phpstorm Sshfs
Posted : admin On 1/29/2022We'll demonstrate sshfs and git checkout below. PHPStorm opened to a project with the code which matches the remote machine and with the 'Zero Configuration Debugging' button turned on (listening). SSHFS also allows for setting up permanent mount points to remote file systems. This would set a mount point that would persist through restarts of both your local machine and droplets. In order to set up a permanent mount point, we will need to edit the /etc/fstab file on the local machine to automatically mount the file system each time the. Unfortunately I would then lose the use of PHPStorm and all the benefits a solid IDE brings to Drupal 8 development. Enter sshfs # OSX brew install sshfs # RHEL yum install fuse-sshfs # Debian/Ubuntu apt-get install sshfs. Create a host in /.ssh/config to make life simple.
PhpStorm integrates with compilers that translate Sass, Less, and SCSS code into CSS. To use a compiler in PhpStorm, you need to configure it as a File Watcher based on the relevant predefined template.
You can also use the compiler from the command line or configure it as a third-party tool, see Configuring Third-Party Tools for details.
Before you start
Make sure you have Node.js on your computer.
Make sure the File Watchers and Less or Sass bundled plugins are enabled on the Settings/Preferences Plugins page, see Managing plugins for details.
Installing Sass/SCSS
In the embedded Terminal (Alt+F12), type:
npm install -g sass
Learn more from the Sass official website.
You can also install the sass package on the Node.js and NPM page as described in npm, pnpm, and Yarn.
Installing Less
In the embedded Terminal (Alt+F12), type:
npm install --global less
Learn more from the Less official website.

You can also install the less package on the Node.js and NPM page as described in npm, pnpm, and Yarn.
Compiling your code into CSS

To compile your code automatically, you need to configure a Sass, Less, or SCSS File Watcher which will track changes to your files and run the compiler.
When you open a file, PhpStorm checks whether an applicable File Watcher is available in the current project. If such File Watcher is configured but disabled, PhpStorm displays a popup that informs you about the configured File Watcher and suggests to enable it.
If an applicable File Watcher is configured and enabled in the current project, PhpStorm starts the compiler automatically upon the event specified in the New Watcher dialog.
If the Auto-save edited files to trigger the watcher checkbox is selected, the File Watcher is invoked as soon as any changes are made to the source code.
If the Auto-save edited files to trigger the watcher checkbox is cleared, the File Watcher is started upon save (File Save All, Ctrl+S) or when you move focus from PhpStorm (upon frame deactivation).
Learn more from File watchers.
PhpStorm creates a separate file with the generated output. The file has the name of the source Sass, Less, or SCSS file and the extension .css. The location of the generated files is defined in the Output paths to refresh field of the New Watcher dialog. However, in the Project Tree, they are shown under the source file which is now displayed as a node.
Create a File Watcher
In the Settings/Preferences dialog Ctrl+Alt+S, click File Watchers under Tools. The File Watchers page that opens shows the list of already configured File Watchers.
Click or press Alt+Insert. Depending on the tool you are going to use, choose the Less, Sass, or SCSS predefined template from the list.
In the Program field, specify the path to the compiler archive depending on the chosen predefined template.
lessc for Less.
sass for Sass/SCSS.
If you followed the standard installation procedure with npm, PhpStorm locates the required files itself and fills in the field automatically. Otherwise, type the path manually or click and choose the file location in the dialog that opens.
Proceed as described in File watchers.
Configuring syntax highlighting
You can configure Less/Sass/SCSS-aware syntax highlighting according to your preferences and habits.
In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor Color Scheme Less/Sass/SCSS.
Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Configuring colors and fonts.
This article address some common problems/caveats when using WSL as your daily development environment.
Access Windows File under WSL
WSL use a plugin called DrvFs to mount Windows drive
Auto-mount all Windows drive to,/mnt/
for example /mnt/c
For more detailed explanation: https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/
Phpstorm Ssh Key
Access Linux File under Windows
DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.
Also note: Opening files using some Windows tools may read-lock the opened files and/or folders, preventing updates to file contents and/or metadata, essentially resulting in corrupted files/folders.
Phpstorm Ssh
Recommendation: Start an SSH server under WSL, and access it via FileZilla / SSHFS
Share Windows file to WSL
The easiest and most convenience way is to share Windows file to WSL, for Example: Create a folder in C:varwww
The folder will be visible in WSL as /mnt/c/var/www/
Then ln -s /mnt/c/var/www /var/www
Fix Permission under DrvFs always being 0777
Since Build 17063, WSL includes an improvement that handles permissions under DrvFs (i.e. Windows drive) properly.
But did not enable it by default.
Create /etc/wsl.conf
and add this content to enable metadata
mount option by default.
Reference: https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/
Reference: https://blogs.msdn.microsoft.com/commandline/2018/02/07/automatically-configuring-wsl/
PHPStorm Bash Integration
Settings > Tools > Terminal
Shell Path: C:WindowsSystem32bash.exe
PHPStorm NPM Integration
PHPStorm 2018.2 and above support triggering Node.JS from WSL
https://blog.jetbrains.com/webstorm/2018/06/webstorm-2018-2-eap-182-3208/
Settings > Languages and Frameworks > Node.JS and NPM
Node Interpreter: Add WSL > Linux Distro: Ubuntu 18.04, Path: /usr/bin/node
Package Manager: /usr/share/npm
Add Git Prompt
[email protected] /var/www/project1 (master)
Add the following lines to ~/.bash_profile
Git Repository Line Ending Problem
If you checkout a Git repository in Windows, some files end in rn
may cause problem (Especially .sh files)
If you’re on a Linux or Mac system that uses LF line endings, then you don’t want Git to automatically convert them when you check out files; however, if a file with CRLF endings accidentally gets introduced, then you may want Git to fix it. You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:
Run this in WSL and checkout your repository using Git in WSL again.
git config --global core.autocrlf input
Git Repository Permission Problem
Another problem, if you checkout a repository in WSL, your IDE/git in Windows may always considered files as changed (Permission changed)
Run this in Windows side to make Git ignore permission change.
(First line remove default true for working copy, Second line set false for Windows side)
git config --unset core.filemode
git config --global core.filemode false
Apache H00076: Failed to enable APR_TCP_DEFER_ACCEPT
Although it does not harm anything, add this two lines to /etc/apache2/apache2.conf
Blue Color too dark on WSL bash
Phpstorm Ssh Remote
The blue text on black background barely readable, there are options, and repositories for this setting.
My personal favorite theme makes WSL bash looks similar to native Ubuntu bash terminal.
SSHd – Could not load host key: /etc/ssh/ssh_host_rsa_key
Bash Disable Bell on Tab Key
Phpstorm Ssh Terminal
Add the following line to ~/.inputrc