PHP on IIS: Installation and Configuration

Presentation

In this tutorial, I will explain how:

  • Install PHP on IIS
  • Configure PHP with PHP Manager for IIS
  • Website creation or vhost
  • Run different PHP versions depending on the site

Prerequisites

For PHP implementation under IIS, you need a web server with the IIS service.

A tutorial is available: Windows Server: IIS installation.

PHP installation

From the IIS console, click Web Platform Installer 1 .

Exécuter web plateform installer pour installer php sous iis

Wait while loading …

Chargement du module

In the search box enter PHP 1 and press the Enter key.

Rechercher PHP

All available PHP versions must be displayed, click on the button Add 1 .

Résultat de la recherche

Adding PHP to IIS by the Web platform installer also attempts to install PHP Manager for IIS A . Click on the Install 1 button.

Sélection de PHP

On the new window that opens, click on I accept 1 .

Résumé des composant à installer

Wait while downloading and installing PHP.

Installation des composants

It is possible that the installation of PHP Manager is in error A depending on the version of Windows. The installation of PHP Manager is processed afterwards. Click on the Finish 1 button to close the wizard.

Résultat installation

To check PHP activation, return to the IIS home page and click Manager Mappings 1 .

Aller sur le mappage

If the menu is not available, restart the IIS console.

Both versions of PHP 1 are installed.

Vérification de l'activation de PHP

The order of the modules is important, the mapping rules are read from top to bottom.

By double clicking on a record, it is possible to access the properties of the module.

Détail du module

Installing PHP Manager for IIS

Download the corresponding version of PHP Manager for your operating system here.

If the error message asking to install .NET Framework 2.0 appears, click No 1 and add by adding roles and features.

Message d'alerte .NET Framework 2.0

Click on Next 1 .

Programme d'installation de PHP Manager for IIS

Accept license 1 and click Next 2 .

Accepter la licence

Close the installation wizard by clicking Close 1.

Installation de PHP Manager for IIS terminée

Close and restart the IIS console.

PHP configuration

From the IIS console, click PHP Manager 1 .

Lancer la console PHP Manager

Since PHP Manager, it is possible to administer almost the entire configuration, manage extensions, add / remove versions of PHP …

Gestion de PHP sous IIS

IIS uses a configuration inheritance system, any server-level console changes will be applied to all sites if a different configuration is not configured.

Enable a PHP extension

From PHP Manager, click Enable or disable a 1 extension.

Gestion des extensions PHP

The set of extensions available on the server for the version of PHP that appears group by state. A the active extensions and B the inactive ones.

Aperçu des extensions disponibles

Select the extension you wish to activate 1 , right click on it and click on Activate 2 .

Activation d'une extensio

The extension goes into the group of activated 1 .

Extension activée

Return to the IIS home page and Restart 1 the IIS service for consideration.

Redémarrer IIS

Use different versions of PHP depending on the sites

In this part, we will see configure IIS to use a different version of PHP depending on the site (vhost).

Prerequisites for this part:

  • Have multiple versions of PHP available on the IIS server.
  • Create the DNS records in order to access the sites.

To illustrate the tutorial, we will set up two sites on IIS, which will work with two different versions of PHP (5 and 7).

Create the 1 folders that will receive the websites.

Dossier site

On the IIS interface, right click on Sites 1 and click on Add a website … 2 .

Ajouter un site sous IIS

Enter the name of the site 1 , the folder where it will be hosted 2 , the full DNS name of the site 3 and click on the OK 4 button.

Configuration du site

Do the same for the second site (php5.rdrit.lab).

Both sites 1 are now created.

Listes des sites

In the folders that host the sites, create a new phpinfo.php file and enter the following code:

<?php phpinfo(); ?>

Launch an internet browser and enter the url of sites. They are normally on the same version (PHP 7.2.2).

Résultat PHP Info

Return to the IIS console, click on php5 1 and click on PHP Manager 2 .

Edition du site PHP5

Click Change version of PHP 1 , then in the window select version 2 and click on OK 3 .

Changer la version de PHP

The current version of PHP has been modified 1 .

Visualisation du changement de version

Go to the site management and restart the 1 .

Redémarrer le site

Return to the browser and refresh the page to see the version change with phpinfo 1 .

Les versions de PHP sont différentes

Related Posts


Windows 10: Install an IIS web server

Presentation In this article, I will explain how to install an IIS web server on a computer with Windows 10. IIS is a Web server developed by Microsoft that is also available on servers. The version i

Redirect HTTP to HTTPS over IIS

In this tutorial, we'll see how to automatically redirect http requests to https under IIS. Prerequisites : Valid configuration of your site with SSL. Have the Rewrite module installed under IIS. The

IIS installation on Windows Server

IIS (Internet Information Services) is a proprietary WEB server available on Windows systems, many Windows features and software rely on it as: ExchangeSharePointWSUSADRMS... Like Apache, it supports