Howto: Install Php and Composer on Windows

Recently I had to install Composer on my Windows 10 system, it’s quite easy but you need to satisfy some dependencies first, so, I wrote this little howto, I hope it will help.

1 – Download and install Php binaries

Go to this page and download the binaries for your platform, I used the “VC14 x64 Non Thread Safe” zip file.

Unzip it to C:/Php7 or another folder of your choice.

2 – Configure php.ini

To run Php, we need a php.ini file. Open your php folder, there should be a file named php.ini-production. Copy and rename it to php.ini, finally open it in a text editor.

Composer needs the php_openssl extension, so we must enable it.

Modify the following block by de-commenting the “extension_dir” option:

 ; Directory in which the loadable extensions (modules) reside.
 ; http://php.net/extension-dir
 ; extension_dir = "./"
 ; On windows:
 extension_dir = "ext"

Then enable php_openssl.dll:

extension=php_openssl.dll

 

3 – Install Composer

Now it’s time to download Composer, the Windows Installer is near the end of the page.

During the setup we’ll be asked about the php.exe path, just browse to the php folder we created in step 1, the file is there.

If the setup fails because your sistem is missing VC++ libraries, donwload them from this link, then run Composer setup again.

4 – Test it

Open a new Windows console and type:

 composer -h.

If everything is in place, you should see the program help message.