2.1. Installation in Windows

To download the Windows distribution you should visit the download section of the binary files of the official PHP site: http://windows.php.net/download.

Each release is supplied with four options:

  • х86 Non Thread Sаfe – 32-bit CGI-variant of the distribution kit;
  • х86 Thread Safe – 32-bit version for installation as a Web server module;
  • x64 Non Thread Safe – 64-bit GGI-version of the distribution kit;
  • x64 Thread Safe – 64-bit version for installation as a Web server module.

The Thread Safe option is designed to safely run PHP in parallel threads within a single system process, for example, if PHP is installed as an Apache Web Server module.

Since we are going to use the built-in server, it doesn’t matter which distribution kit is chosen, it’s best to use the Non Thread Safe option. The latter option is also used when connecting PHP as an external Fast-GGI application that runs on each external request.

Before the distribution name can be placed one of the abbreviations VC11, VC14, meaning the version of Visual Studio (2012 and 2015, respectively), with which the distribution was compiled. In order to successfully launch a project, you must download the appropriate Visual C++ Redistributable Package for Visual Studio, which contains the necessary dynamic libraries:

VC 11 option

http://www.microsoft.com/en-us/download/details.aspx?id=30679;

VC 14 option

http://www.microsoft.com/en-us/download/details.aspx?id=48145.

ATTENTION! The libraries are required from the English version of Visual Studio, the Russian version of the package will not work.

After downloading the zip file, it should be unpacked into some folder, for example C:\php. You can make sure that .PHP is available by running the command line, and then go to the C:\php folder with the command1

> cd C:\php

By running the command php with the -v option on the command line, you can find out the current version of PHP:

> php -v
РНР 7.0.0 (cli) (built: Dec 3 2015 09:31:54) ( NTS)
Copyright (с) 1997-2015 The РНР Group
Zend Engine vЗ.0.0, Copyright (с) 1998-2015 Zend Technologies 

In order for the PHP command to be available at any point in the file system, the path to the PHP interpreter should be specified in the PATH environment variable. To access environment variables, open the Control Panel, go to the System section. The fastest way to get to this point is to right-click on the Start button and select the System item from the context menu. On operating systems prior to Windows 8, select the Computer item in the Start menu and select Properties in the context menu. In the Control Panel window that opens, with the active System section on the left, click the Advanced system settings link. Then in the System Properties window on the Advanced tab, you must click the Environment Variables button. In the dialog box that opens, in the System variables section, find the PATH environment variable and add it to the C:\php directory. Separate paths in the value of the PATH variable are separated by a semicolon (no semicolon is required at the end of the entire line). After that the php command will be available in any folder of the computer.


1 In boldface we will highlight the commands or text entered by the user.