Installing php7.2 or (7.x), composer and git under Ubuntu for Windows / Linux Subsystem

# linux# mysql# php# windows



The first requirement is that you have Ubuntu for Windows installed.

You may install it via the Microsoft Store.

Then you simply open it up (it may require a reboot or two) by clicking on it in the start menu.

Press the Windows key and search for "Ubuntu" and it should appear like below


Installing php and composer

Type in the following:

sudo apt-get install -y git php7.2-cli php7.2-curl php7.2-xml php7.2-mbstring php7.2-gd php7.2-sqlite3 php7.2-mysql

If you want another minor version, simply swap out the number 2 to the version number you need on all packages.

After that is done, head over to and follow the instructions on how to install composer by the command line.

Currently when writing this, the instructions are the following:

php -r "copy('', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');


When that is done, you may move the composer file to a place where the $PATH looks for binaries.

sudo mv composer.phar /usr/local/bin/composer


Now you have php version 7.2, composer and git installed on your system.

To verify this, you can type:

php -v

All three commands should give output that is not an error.