Skip to main content
Go to homepage
Github

Internet Information Services (IIS)

Learn how to configure an IIS (Internet Information Services) server.

IIS is built in to Windows. On Windows Server, the IIS role can be added via the Server Manager. The CGI Role Feature needs to be included. On Windows Desktop, IIS has to be added via the Control Panel's Add/Remove Programs.

Installing IIS

  1. In Windows, access the Control Panel and click Add or Remove Programs.
  2. In the Add or Remove Programs window, click Add/Remove Windows Components.
  3. Select the Internet Information Services (IIS) check box, click Next, then click Finish.
  4. To learn how to use IIS, you can view the documentation at:
    http://localhost/iishelp/iis/misc/default.asp

Configuring IIS

  1. Right-click the My Computer icon on your server computer desktop, and then click Manage.
  2. In the Computer Management dialog box, open the Services and Applications node.
  3. Click Internet Information Services, and then click Web Sites.
  4. Right-click the Default Web Site node to start it, if it is not started already.
  5. If a secure Internet connection is required, set up Secure Sockets Layer (SSL).

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

Navigate using CMD to:

cd %windir%\System32\inetsrv

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

FastCGI on IIS supports impersonating the requesting client's security tokens. This allows IIS to define the security context under which the request executes. To do this, remove the ;:

;fastcgi.impersonate = 1