Welcome to Mastering PhpStorm, a video course for the state-of-the-art PHP developer who wants to work efficient and successful in a beautiful IDE. This is the best way to learn and master PhpStorm. Try starting PHPStorm by running phpstorm in your terminal. As I'm lazy, I added the following alias to.bashrc: alias storm='phpstorm /dev/null 2&1 &' 7. Install inotify for PHPStorm file watchers. PHPStorm will probably complain about file sync being slow when you start it - that's because we did not install inotify yet, which PHPStorm can. Deployment is slow or fails. Deployment can be a resource-intensive operation, especially if a project or a deployment server contains lots of directories and files. In the Settings/Preferences dialog Ctrl+Alt+S, navigate to Build, Execution, Deployment and explore the following configuration options, which can speed up deployment: Exclude directories that are not needed from deployment (for example, images). Each time I open PhpStorm I have the impress that my computer is running a marathon. And he doesn’t do well. Even on my very lightweight arch linux / i3 system (running on very good hardware), everything suddenly slow down. Welcome to the Matrix, or the stop motion applied to computing!
- Phpstorm Close Tab Shortcut
- Phpstorm Slow Cooker
- Phpstorm Slow Start
- Phpstorm Low Memory
- Phpstorm Slow Typing
I just ran across this draft on my machine after several months (I wrote this in January), so hopefully it is clean enoughand I believe the information is still up to date.
Below are my thoughts and experience setting up and testing the use of Window’s WSL 2 system for development work. Thefindings are based on running a production-ready Django application, but only doing minor modifications to test how thedevelopment flow works.
tl;dr
With WSL 2, Windows is nearly what I need for a development environment. The latest Slow Ring release, as of writing this,allows me to work efficiently in the CLI in the same way I would with either MacOS or Linux. If you work entirely withinthe CLI, using Vim for example, then it could be totally usable for you. Similarly, if you work mostly in VS Code, you arealso probably set with WSL 2. VS Code, as a Microsoft product, has great support for WSL and provides many of the tools developersneed.
If your development flow depends primarily on tools from the JetBrains suite of products, then WSL 2 may not be quitegame ready. For example, PyCharm can work as an editor, but many of the features do not work wonderfully well whenyour files live in the WSL environment. This is because it attempts to use path variables for the WSL mount paths withbackslashes (Windows-style) instead of forward slashes when executing against the the WSL remote interpreter. If youare really just using PyCharm for the capabilities of the editor, this may not be a deal breaker though. For example,in my PHP work, I usually use PhpStorm, but run all commands and tests from a terminal. With Python, however, I use thedebugger in PyCharm from time to time, which I can’t find a good way to make work right now.
Setting It Up
The whole environment is based on using the new WSL 2 backendto run a real Linux kernel inside of Windows. To kick things off, if you already have the standard WSL enabled, go aheadand add a Ubuntu distro to your system. If you don’t already have WSL enabled, you can install the distro later. I suggestthe Ubuntu distro because it is the only one supported by Docker for Windows at this time.
The first step of this process is to get yourself onto the Slow Ring of the Windows Insiders Program. Theprocess is pretty simple, but it does mean losing some of yourprivacy when using your Windows machine. I avoided doing this experiment for a long time because of this, but curiousityfinally got the best of me.
Once in the program, you should be able to install the latest build from the Slow Ring. This will take a while, as mostWindows updates do. After that is installed, the instructionsfor setting up WSL 2 are very easy. This will also require a restart along the way.
Finally, I installed the new Windows Terminalapplication. I have used Cmder in the past for Windows terminal access and just never realy loved it. I find the newWindows Terminal beta easy to use and a clean design. It is my go-to terminal on Windows now for sure.
Some Hiccups
After I had a Ubuntu environment, I tried to set it up as I would any other Linux environment and ran into a couple ofsmall issues.
The first issue was that running apt update
behind ExpressVPN failed to connect to some remote servers properly.After updating, there have been no issues with apt install
. Looking back, I’m not sure if this is only a WSL thingor not, but it is something to be aware of.
The second hiccup came from my oh-my-zsh configuration as a very slow rendering when initializing or handling commands.The behavior was similar to an issue I found on Github,but in my case, I determined it was the size of the PATH
variable that created the issues. By default the Windows path is added to the Linux path in WSL 2, and when my .zshrc
attempted to add more information to that path, everything ground to a halt. To avoid this, I added a new /etc/wsl.conf
file with the following details and restarted WSL by running wsl.exe --shutdown
and then wsl.exe
.
This shortened my PATH
variable greatly and made everything quick and snappy.
Docker for WSL 2
Docker with WSL 2 support was a snap to install. At thetime of writing this, the tool only fully supports Ubuntu, which is why I suggest going with that Distro, even if itisn’t your favorite.
Once installed, Docker just works within your Linux environment, including Docker Compose, which I use heavily in mydevelopment workflow.
Code Editor
PyCharm
PyCharm can work as an editor, but many of the features do not work wonderfully well when your files live in the WSLenvironment. This is because it attempts to use path variables for the WSL mount paths with backslashes (Windows-style)instead of forward slashes when executing against the the WSL remote interpreter. If you are really just using PyCharmfor the capabilities of the editor, this may not be a deal breaker though. For example, in my PHP work, I usually usePhpStorm, but run all commands and tests from a terminal.
The first thing I determined was that this required the Professional version of PyCharm. The Professional versionincludes features for using remote interpreters,including WSL.
Second, I looked into how I could make PyCharm use the git binary from my Linux environment. There is atool to support this. There are some caveats about this not workingwith all git commands at the time, though, so I stuck with just installing git directly to windows and having twoexecutables on the system.
It was also necessary to enable case sensitivity from the Windows version of Pycharm as noted in thisissue.
Phpstorm Close Tab Shortcut
Finally, I ran the commands suggested here,but based on more recent comments I don’t know if it was neccessary or not. It was easy enough to do, though, and it doesnot appear to have caused any issues.
VS Code
Since PyCharm is not currently capable of providing me debugging support, I decided to look into Visual Studio (VS) Codeinstead. Since this tool is built by Microsoft it has excellent WSL support. If you are comfortable working within VS Code,then the Windows environment may be great. Personally, my muscle memory is so inherently linked to JetBrains tools that itis hard for me to switch.
Conclusions
The experience of setting up my development environment was good. It took less than a day to get this much figured outand working. By the end of it I was able to set up a Django project running directly in Ubuntu, with the database runningvia Docker Compose. I was able to use native Windows applications to interact with the application and make alterationsto my code quickly.
There are some things that I think this proposed Windows environment could improve upon though:
- Better window management. I found the new PowerToys library created by Microsoftthat provides some window management. This is a promising tool, but it still has a lot to work on, like allowing for keyboardhotkeys to move a window into a particular position as well as moving windows between virtual desktops.
- Configurable hotkeys. There are some tools that allow for you to create hotkeys in Windows, but it does require manipulatingregistry keys, which isn’t my favorite.
- For Python, I need full support for PyCharm and its debugger. Maybe as I get better with the language this will beless of an issue, but it is a deal breaker right now.
I'm changing my dev environment quite frequently, always looking for the current best option. While Windows with ddev was an ok option for TYPO3 development, since I'm doing Shopware including frontend development with lots of files in node-modules and corresponding file watchers, that setup has become too slow to comfortably work with. Now I finally found a setup based on Windows and WSL2 with Ubuntu that is a pleasure to work with, with all the benefits of having Linux as development environment seamlessly embedded into the Windows host system.
In this post I'm describing how to set all that up.
Goals:
- Usable PHPStorm with fast file sync
- Common development tools (git, ssh, tests) running
- No restarts, no dual-boot, no weird workarounds, no file mounts or nfs
- Running system.d, ssh agent and snap on Ubuntu
- Seamless integration into Windows
For example consider the following screenshot:

- Firefox is running on Windows
- Chromium is running on Linux
- The Windows Terminal App is running an Ubuntu Bash
- PHPStorm is running on Linux
1. Install WSL2 with Ubuntu 2020
Snagit mac m1. First of all, you need to enable WSL2 and install Ubuntu. If you already have WSL2 enabled, get Ubuntu from the Microsoft store. Otherwise, find a tutorial here: https://www.omgubuntu.co.uk/how-to-install-wsl2-on-windows-10
2. Install x410 as display manager
To be able to seamlessly integrate Windows and Linux you will need a display manager / XServer. I use (and recommend) X410 (https://x410.dev/). It's currently available for less than 10 Euro in the Microsoft store and 'simply works'.
After installing X410, add the following line to your .bashrc
:
connecting your Ubuntu bash with the XServer.
If you want to get even more out of the XServer, check out the Cookbook on its website (https://x410.dev/cookbook/) - for example I added the XServer to the autostart.
3. Use keychain as ssh agent
Having an ssh agent available and loading your ssh key by default makes working with ssh or git much easier. To use your SSH key in Ubuntu, copy it to ~/.ssh/id_rsa
:
Then install keychain as SSH agent and manager:
To load the key automatically and start the agent, add the following line to your .bashrc
:
(of course, you can add / load other keys here, too)
More info or other ways to add SSH authentication can be found at https://medium.com/@pscheit/use-an-ssh-agent-in-wsl-with-your-ssh-setup-in-windows-10-41756755993e
4. Install Docker and enable WSL2 support
Current docker installations support WSL2 already. If you already have Docker installed, you can enable WSL2 integration, otherwise install it first. You can select the distributions where you want to use docker. After enabling, you might need to restart your WSL2 distribution to have it available.
5. Use 'systemd' hack to use snap (optional - be careful)
I wanted to be able to use snap for installing tools like node and PHPStorm - to make that possible, I needed to get systemd functional. There is no official support for running systemd on WSL2, however there are 'hacks' / 'workarounds' to make it work. Take a look before you leap and use with caution:
There may be other / updated ways to get it running at this point, keep an eye on https://github.com/microsoft/WSL/issues/5126
Once that's done, snap should be running:
6. Install PHPStorm with Snap
Now we are finally ready to install PHPStorm.
EAP:
Stable:
see also https://blog.jetbrains.com/phpstorm/2017/12/install-phpstorm-with-snaps/
Try starting PHPStorm by running phpstorm
in your terminal. As I'm lazy, I added the following alias to .bashrc
:
7. Install inotify for PHPStorm file watchers
PHPStorm will probably complain about file sync being slow when you start it - that's because we did not install inotify yet, which PHPStorm can utilize. To do so, type:
As the default amount of files a user can watch is pretty low - especially if you are doing anything frontend related ;) - you can increase that number by adding the following line in /etc/sysctl.conf
:
Phpstorm Slow Cooker
and applying the change:
For more info see https://blog.jetbrains.com/idea/2010/04/native-file-system-watcher-for-linux/
For debugging the file watcher see https://confluence.jetbrains.com/display/~roman.shevchenko/Debugging+native+file+system+watcher+for+Linux
Success!
You now have a running Ubuntu with PHPStorm incl. fast file sync.
-- Optional --
🐵 Random Stuff 🐵
The following section contains additional things I did to customize my environment and make it more fun to use - just in case someone is interested.
8. Install PHP / Composer / Node locally
As I'm doing quite a bit of development directly based on a local PHP server and nothing else, run Cypress acceptance tests via Node in PHPStorm etc. it's important for me to have my tools 'at hand' without the need to start or run a docker container.
I additionally installed PHP7.4 via apt (apt install php7.4-*
), composer via the recommended install script and node via snap install node
.
9. Recommendation: Use Windows Terminal - with Emoji Support 🐱🐱🐱
As a terminal application I'm using the new Windows terminal - it's fast and has some nice features like tabs for different terminals (you can mix and mash Ubuntu and Powershell for example), colored tabs and - most important: EMOJIs!
Get it from the Windows Store: https://www.microsoft.com/de-de/p/windows-terminal-preview/9n8g5rfz9xk3
10. Customize your prompt and git environment (PS_1)
As you might have seen I'm a big fan of customizing your bash prompt and displaying git status information directly. To do that, I'm using the brew formula bash-git-prompt
. To install, first install linuxbrew and then tap the formula
See https://docs.brew.sh/Homebrew-on-Linux and https://formulae.brew.sh/formula/bash-git-prompt
11. Scaling issues
Depending on your system, you might have scaling issues when using Linux GUI Apps. In my case, adding the following to vars helped:
12. Install ddev on Ubuntu
I'd recommend installing and using ddev on Ubuntu, too - to install (if you installed linuxbrew in step 10):
See https://ddev.readthedocs.io/en/stable/#installation for more in-depth instructions.
13. Setup GPG TTY for signed commits
When using Git with signed commits from Ubuntu you may need to set a TTY for GPG to allow unlocking your key.

Add the following line to your .bashrc
:
Phpstorm Slow Start
14. Bonus: Set keyboard layout to Dvorak on WSL2/X410
Phpstorm Low Memory
Some might know I'm using Dvorak as keyboard layout - to do so in Ubuntu GUI apps add the following to profile or .bashrc
:
Phpstorm Slow Typing
That's it
I hope some of it is useful - if you have any questions or feedback let me know via Twitter (https://twitter.com/sasunegomo) or TYPO3 Slack (@susi)
