Motivation:
- You want to understand how PHP works with IIS.
- You want to prepare a PHP or WordPress development environment on Windows.
- You want to update PHP to any version to address compatibility or security issues on Windows.
Solution:
- Install CGI for IIS on Turn Windows features on or off > Internet Information Services > World Wide Web Services > Application Development Features > CGI.
- Download VS16 x64 Non Thread Safe package under PHP 8.1 section on https://windows.php.net/download/.
- Extract the ZIP file to C:\Program Files\php-8.1.10-nts-Win32-vs16-x64 folder.
- Download the cacert.pem file and move it to the C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl folder.
- Copy the php-.ini-development file to php.ini.
- Open the php.ini file and uncomment the following lines
fastcgi.impersonate = 1;
cgi.fix_pathinfo=1;
cgi.force_redirect = 1 (and change the value to 0, i.e. cgi.force_redirect = 0)
extension_dir = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\ext"
extension=curl
extension=fileinfo
extension=gd
extension=gettext
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
extension=openssl
extension=pdo_mysql
error_log = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\php_errors.log"
error_log = syslog
curl.cainfo = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl\cacert.pem"
openssl.capath="C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl\cacert.pem"
- Add C:\Program Files\php-8.1.10-nts-Win32-vs16-x64 to SYSTEM PATH.
- Restart your machine.
- Open cmd and execute the command below to ensure that the PHP file can be found in the SYSTEM PATH.
php --version
- Open IIS, click on Server name, double click on Handler Mappings > Add Module Mapping with below information.
Request path = *.php
Module = FastCgiModule
Executable = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\php-cgi.exe"
Name = PHP 8.1
Request Restrictions = File or folder
- Create phpinfo.php file with below content in the root website folder.
<?php phpinfo(); ?>
Problem:
Some applications do not work with the latest Microsoft .NET Framework. You need to remove it and install an older version of Microsoft .NET Framework.
Solution:
1. Use below utility to remove the current Microsoft .NET Framework.
.NET Framework Cleanup Tool
2. Download an appropriate version of Microsoft .NET Framework using one of below links and install it.
3. Use below utility to detect the installed Microsoft .NET Framework versions.
.NET Detector
Software development and software engineering research