To install PHP 7 on Windows there are a few dependencies that must first be installed for PHP to work correctly, else you may experience strange and unhelpful error messages. I had a few issues when trying to install PHP 7 on my Windows PC at my place of work. Hopefully this tutorial will prevent you from coming across these same issues when you come to install PHP 7 on your Windows computer.

Downloading PHP 7 and Dependencies

PHP 7 for Windows can be downloaded via the official site. Here you will be presented with a multitude of options ranging from 32 bit, 64 bit, non-thread safe and thread safe versions of PHP. To keep things simple I suggest sticking with non-thread safe, as for almost all situations it won’t make a difference. Otherwise download the 64 bit version of PHP if you are running a 64 bit operating system, which many people now are, or rather the 32 bit version if the latter isn’t true.

Installing VC++ 2015 Redistributable

Once PHP has downloaded, I suggest extracting the contents to a PHP folder placed within your boot drive – commonly C:\. From here we will check whether or not we already have the required dependencies to run PHP 7. To do this open up control panel and navigate to installed programs. We are looking for the 2015 Visual C++ redistributable equivalent to your install of PHP. If you opted for 64 bit edition of PHP you will need the 64 bit redistributable and vice versa.

PHP 7 Windows Dependencies

To easily access PHP from the command line, it’s often recommended to add PHP as a PATH variable. Navigate to Control Panel > System and Security > System, and click on “Advanced system settings”, which should be visible in the sidebar to the left. At the bottom of the popup you will see a button marked “Environmental Variable…”, click on this and edit the PATH variable as seen in the image below:

Adding PHP 7 to PATH

And finally, to check that everything is working open up command prompt and type ‘php -i’. If an is returned then something has gone wrong, and you should refer back to the steps above. Otherwise a long list of text should output to the screen, detailing the PHP installation.

Install Composer with PHP 7

Installing  PHP 7 on Windows with Composer is optional, but if you wish to use Composer with Windows there are some additional steps to follow. To make sure that Composer can install correctly, we must enable a couple of extensions within our PHP installation’s php.ini file. The extensions that we need to enable are php_mbstring and php_opensll.

Open up PHP’s installation directory, this will be C:\PHP. From here rename the file ‘php.ini-production’ to ‘php.ini’. Open this file with the text editor of your choice and uncomment the lines highlighted below:


That’s it, install Composer and everything should be good to go. Feel free to comment below if you run into any issues and we’ll try and help you out.

  • nice post i like it

  • Elkin

    great article! thanks a lot :)