IIS Express
IIS Express is a lightweight, standalone version of IIS optimized to develop and test websites, while still providing all the core features of IIS.
In addition to having extra features designed to facilitate website development, including:
- It doesn't run as a service or require administrator user rights to perform most tasks.
- Multiple users of IIS Express can work independently on the same computer.
Installing IIS Express
Go to https://www.microsoft.com/en-US/download/details.aspx?id=48264 and download and install the version suitable for your operating system.
Installing PHP
Access https://www.php.net/downloads.php?os=windows, then download Non Thread Safe (NTS) version of PHP.
Após a conclusão do download, você pode extrair o arquivo para qualquer pasta desejada, utilizando tar a linha de comando:
mkdir C:\php8_5
tar -xf "php-8.5.9-nts-Win32-vs17-x64.zip" -C "C:\php8_5"
Or using Power Shell
Expand-Archive -LiteralPath ".\php-8.5.9-nts-Win32-vs17-x64.zip" -DestinationPath "C:\php8_5"
Configuring PHP
If you have installed the IIS Express x64:
cd C:\Program Files\IIS Express
If you have installed the IIS Express x86:
cd C:\Program Files (x86)\IIS Express
To make things easier, you can define the following variable (depending on the path where php-cgi.exe is located):
set PHP_PATH=C:\php8_5
Set FastCGI and the handler for PHP with the commands:
appcmd set config /section:system.webServer/fastCGI /+[fullPath='%PHP_PATH%\php-cgi.exe']
appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%PHP_PATH%\php-cgi.exe',resourceType='Unspecified']
appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script
Configure the FastCGI and environment variables and the php.ini file using the following commands:
appcmd set config -section:system.webServer/fastCgi /[fullPath='%PHP_PATH%\php-cgi.exe'].instanceMaxRequests:10000
appcmd set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_PATH%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']"
appcmd set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_PATH%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%PHP_PATH%\php.ini']"
It will probably be necessary to disable FastCGI logging in php.ini to prevent errors from being added to the end of all HTTP responses. To do this, remove the ; from the directive:
;fastcgi.logging = 0