Setup Windows Subsystem for Linux (WSL)

Need an easy way to develop php applications on Windows? Learn how to setup WSL for PHP development.


  1. Make sure you are using Windows Pro since Docker needs hyper-v which is only in the pro version

  2. Install Ubuntu from the Microsoft store

  3. Open the Ubuntu CLI app

  4. I recommend installing Visual Studio Code with WSL extensions from Microsoft

  5. Then you can use the code command to open VS Code from Ubuntu WSL eg. code .

  6. For the best file system performance and proper inotify events to be fired the git repo code should be cloned in side of Ubuntu

  7. Make sure git is installed in Ubuntu WSL sudo apt-get install git

  8. Install docker

  9. Install docker compose

  10. Install PHP

    sudo apt install php
    sudo apt install python-software-properties
    sudo add-apt-repository ppa:ondrej/php
    sudo apt install php8.0
  11. Switch PHP version sudo update-alternatives --config php

  12. Install composer

    php -r "copy('', 'composer-setup.php');"
    php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
  13. Install PHP extension for PHP version sudo apt-get install php8.0-gd php8.0-mcrypt php8.0-curl php8.0-intl php8.0-xsl php8.0-mbstring php8.0-openssl php8.0-zip php8.0-soap

  14. Optionally Install Composer Satis for faster composer installs and easier auth with private packages

    git clone
    php bin/satis
    php bin/satis build satis.json public -vvv