Setup Windows Subsystem for Linux (WSL)

Need an easy way to develop php applications on Windows? Learn how to setup WSL for PHP development.
Photo by Tadas Sar on Unsplash


  1. Make sure you are using Windows Pro since Docker needs hyper-v which is 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 clone the git repo code in side of Ubuntu
  7. Install git in Ubuntu WSL sudo apt-get install git
  8. Install docker
  9. Install docker compose
  10. Install PHP
    sudo apt install phpsudo apt install python-software-propertiessudo add-apt-repository ppa:ondrej/phpsudo apt install php8.0
  11. Switch PHP versionsudo 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.phpphp -r "unlink('composer-setup.php');"
  13. Install PHP extension for PHP versionsudo apt-get install php8.0-gd php8.0-mcrypt php8.0-curl php8.0-intl php8.0-xsl php8.0-mbstring openssl php8.0-zip php8.0-soap
  14. Optionally Install Composer Satis for faster composer installs and easier auth with private packages
    git clone bin/satisphp bin/satis build satis.json public -vvv


Published Modified