Install 7.4 on Windows + IIS


If you're wanting to run PHP 7.4 on Windows using IIS (Internet Information Services) then you will first need to download one of the ZIP files below.

Please pay attention to the additional download and install requirements for the Visual Studio Runtime Environment as without these you may encounter an error when attempting to run PHP.

This article assumes that you already have IIS installed and have already setup a local site with suitable permissions.

Windows Downloads (Release 7.4.8)

This list only shows the non thread-safe builds that are suitable for using with the FastCGI setup described on this page.

If you would like to see a complete list of Windows downloads for PHP 7.4.8, including thread-safe and debug & development kits, please see here.

Unzipping PHP 7.4

Once you have downloaded the appropriate ZIP file, unzip it to your hard drive. You will want to place it in a suitable location. In most cases, it is recommended that you create a new directory in C called PHP, and then a subdirectory for the version of PHP that you will be installing.



Selecting Your INI File

Most of the PHP configuration options are controlled by a php.ini file. You can open, read and edit these files using any simple text editor such as notepad or Notepad++.

The directory that you just unzipped the PHP code to will now contain two of them, one called php.ini-development and one called php.ini-production which act as basic templates for the role you're going to use this machine for.

php.ini-development defaults to showing errors and warnings that will allow you to more readily develop and debug code.

php.ini-production defaults to hiding errors. This should be your template if you are going to be running PHP on a public facing server.

Example INI

We will assume this is for development purposes, so begin by renaming php.ini-development to php.ini.

Configuring Internet Information Services (IIS) FastCGI

Running PHP on IIS is most effective using FastCGI. This is a protocol built in to many webservers where the webserver will manage a "pool" of processes, and will distribute incoming requests to them to process, and then return the result to the web server to send back to the person requesting it.

To configure IIS with PHP, open up the IIS Manager and click on the Local Machine icon in the connections panel to the left to open up the main server configuration.

Look for the icon which says FastCGI Settings. If you do not have this option available you may need to install the CGI feature of the IIS Role using Windows Features.

IIS Admin Panel

Open up the FastCGI settings window and then click on Add Application on the right hand side.

The Full Path should be the path to the php-cgi.exe file within the folder that you previously unzipped the install files to. Make sure to select the php-cgi.exe and not the php.exe file.

IIS Admin Panel FastCGI

Good general settings for Instance MaxRequests is 2000, and Max Instances should be 2 (this means your web server will process 2 PHP requests at once).

Setting the Monitor Changes to File to the absolute path of the php.ini that you renamed earlier will automatically restart the web server if you change the configuration file, which is useful for development.

Once you're done, hit OK and your FastCGI settings list should look something like this:

IIS Admin Panel FastCGI

Configuring Your Site

Now that you have FastCGI configured to use PHP, you will need to attach it to your site as a handler mapping.

Select your site from the connections window on the left, and then select handler mappings.

IIS Admin Panel Handlers

Select the Add Module Mapping option from the right hand side to open up the configuration dialog screen.

The request path is which types of file this handler is to process, we want to just handle php files so we add *.php.

The Module will be FastCGIModule.

The Executable will be the full path to the php-cgi.exe that you unzipped earlier. This MUST be identical to the path that you entered while configuring the FastCGI executable in the previous step.

The Name is used for IIS to manage its module mappings, we recommend PHP_via_FastCGI.

IIS Admin Panel Module Mapping

Hit OK and the module mapping should appear in the configuration list.

Testing Your Deployment

The easiest way to check that PHP has been installed correctly is to try printing the PHP information dump.

In the root of your webserver directory (the directory hosting your site, NOT the directory you unzipped PHP into), add the following file called info.php.

IIS Admin Panel Module Mapping

Open your web browser and navigate to the site name that you configured and append info.php onto the URL.

Tip: If you only have a single site this will usually be http://localhost/info.php.

If the installation has succeeded, you will be presented with the PHP info document.

PHP Info Panel

Configuring Extensions

Out of the box, PHP is very bare-bones and has very few functions available.

To access more functions such as database connectivity, JSON parsing, UTF8 handling or to add additional engine enhancements such as the OPCache performance module, we need to enable those extensions.

Fortunately, the Windows PHP ZIP packages come with a large number of modules already available, they're just not enabled. If you want to see which extensions came as standard, you can look in the ext/ directory of the location you unzipped PHP into.

To enable an extension you will need to edit the php.ini file that you renamed earlier.

Open the php.ini file, the first thing we need to do is set the path to the extension directory. That's easy enough as the INI file already has that setting prepared, it's just commented out.

Search for the following line, and remove the semicolon at the start. This will "uncomment" the configuration option and make it active. This will let PHP know to look in the ext directory to find extension files.

;extension_dir = "ext"

Now it's time to select which extensions you wish to enable, this will heavily depend on the requirements of your PHP codebase, and enabling certain extensions will require additional configuration options to be added to tell PHP not only that they should be enabled, but how they should work.

The php.ini file already has entries for all of the extensions it ships with, but they are commented out with semicolons. To enable an extension, just remove the semicolon from before its name.

PHP Extensions

Save the php.ini file. If you configured the monitor changes file earlier, your IIS server should automatically restart PHP with the new settings. If it doesnt you will need to do this manually by issuing "iisreset.exe" from the RUN command using admin privileges.

To Top