Setting up IIS 10 & PHP 7By Dag, on December 30th, 2016
Some reminder notes for setting up a working IIS and PHP environment.
- Install the IIS role/feature w/CGI support. - Download (NTS / Non-Thread Safe) and unzip at e.g. C:\PHP - Register index.php as standard document - Check settings in php.ini fastcgi.impersonate = 1 fastcgi.logging = 0 cgi.fix_pathinfo=1 cgi.force_redirect = 0 date.timezone = "Europe/Oslo" - Modules I'd like to add as a minimum: extension=php_bz2.dll extension=php_curl.dll extension=php_gd2.dll extension=php_gettext.dll extension=php_mbstring.dll extension=php_mysqli.dll - Add a "Module Mapping" to "Handler Mappings" in IIS: Request path: *.php Module: FastCgiModule Executable: C:\[Path to PHP installation]\php-cgi.exe Name: PHP_via_FastCGI + Request Restrictions: "File or folder" - Install Visual C++ 2015 redist (x86 version) to avoid 500 server error.
- Enforce SSL per site and set up a 403.4 error page with a 302 redirect URL for easy HTTPS enforcement. - Remember that a PHP log file will require sufficient write permissions to be created and updated. E.g. all rights to IUSR and CN\IIS_IUSRS. - Tune the server FastCGI settings for max processes and requests. - If using a directory that opendir() doesn't like to cleanup sessions from, I just use powershell to remove the ones that are more than 24 hours old: