Internet Information Services: Difference between revisions
m (3.3 requires 5.6.5+, 7.0.x and 7.1.x is supported. 7.0.x has actual 64bit support) |
|||
(48 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Installing Moodle}}[[Internet Information Services]] ('''IIS''') is the web server software bundled with Windows Server, as well as certain client versions of Windows. Please note Apache web server has much better community support and there are usually fewer problems when running Moodle on Apache. | {{Installing Moodle}}[[Internet Information Services]] ('''IIS''') is the web server software bundled with Windows Server, as well as certain client versions of Windows. Please note Apache web server has much better community support and there are usually fewer problems when running Moodle on Apache. Windows OS is not suitable for large installations because PHP is limited to 32bit even in 64bit Windows, please consider using Linux or other unix-like operating systems instead. | ||
==IIS installation | ==IIS installation steps (Windows 7 and above)== | ||
# Go to Control panel, click on Programs and Turn Windows features on or off | # Go to Control panel, click on Programs and Turn Windows features on or off | ||
# Tick "Internet Information Services" and "Internet Information Services / Application Development Features / CGI" | # Tick "Internet Information Services" and "Internet Information Services / Application Development Features / CGI" | ||
# Install [http://www.microsoft.com/web/downloads/platform.aspx Microsoft Web Platform Installer] | |||
==PHP installation== | ==PHP installation steps== | ||
It is strongly recommended to use only the official MS Platform installer, it automatically installs all necessary components and facilitates easy configuration with PHP manager. Manual installation attempts often fail or may not allow Moodle to function properly. Unfortunately MS does not distribute up-to-date version of PHP, you need to download them manually. | It is strongly recommended to use only the official MS Platform installer, it automatically installs all necessary components and facilitates easy configuration with PHP manager. Manual installation attempts often fail or may not allow Moodle to function properly. Unfortunately MS does not usually distribute up-to-date version of PHP, you may need to download them manually. | ||
# Download | # Install [http://www.microsoft.com/web/downloads/platform.aspx Microsoft Web Platform Installer] | ||
# Download latest PHP 5.5 | # Install latest PHP 5.6.5 or above using Web Platform Installer | ||
# [Optional] Install URL Rewrite 2.0 using Web Platform Installer | |||
Optionally you may install the required components manually: | |||
# Download [http://phpmanager.codeplex.com PHP manager for IIS] and install it | |||
# Download latest PHP 5.6.5+ VC11 x86 Non Thread Safe from [http://windows.php.net/download/ http://windows.php.net/download/] | |||
# Extract the Zip file to a directory such as C:\PHP\ | # Extract the Zip file to a directory such as C:\PHP\ | ||
# Install the Visual C++ Redistributable for Visual Studio 2012 [http://www.microsoft.com/en-us/download/details.aspx?id=30679] - on 64bit Windows install both x86 and x64 | |||
# Open the Internet Information Service (IIS) Manager - right click on This computer and select Manage | # Open the Internet Information Service (IIS) Manager - right click on This computer and select Manage | ||
# Click on PHP Manager icon | # Click on PHP Manager icon | ||
# Register new PHP version - select C:\PHP\php-cgi.exe | # Register new PHP version - select C:\PHP\php-cgi.exe | ||
'''Warning: PHP needs to be configured via FastCGI in IIS, older CGI interface is known to have problems with some file names.''' | |||
== | ==PHP configuration steps== | ||
# Set PHP configuration to values recommended by PHP Manager | |||
# Enable required extensions in the PHP manager: php_intl.dll, php_pgsql.dll | |||
# Enable [[OPcache]] extension | |||
# Set your timezone in PHP.ini | |||
# Set appropriate memory limits in PHP.ini | |||
IIS | ==IIS configuration steps== | ||
# Setup URL rewriting described below | |||
# Configure IIS to show detailed error pages. | |||
# Set very long CGI timeout - 1 hour or better more. | |||
# In IIS Manager add Moodle dirroot directory as a new virtual directory or set it as site directory | |||
=== | ===Slasharguments=== | ||
The function ''slash arguments'' is required for various features in Moodle to work correctly, as described in [[Using slash arguments]]. | |||
IIS 7 should support relative path arguments by default. If it does not work try enabling the following in php.ini | |||
cgi.fix_pathinfo = 1 | |||
===URL rewriting | ===URL rewriting=== | ||
If you can not modify registry as described | If you can not modify registry as described below you may try manual configuration of rewrite rules, the PHP installation via ''Microsoft Web Platform Installer'' installs necessary ''URL Rewrite 2.0'' module. | ||
[[File:Rewrite_rule_-_Internet_Information_Services_(IIS)_Manager.png|thumb]] | [[File:Rewrite_rule_-_Internet_Information_Services_(IIS)_Manager.png|thumb]] | ||
Line 48: | Line 61: | ||
* Append query string - enabled | * Append query string - enabled | ||
* Stop processing of subsequent rules - enabled | * Stop processing of subsequent rules - enabled | ||
===Optional UTF-8 file name fix=== | |||
By default IIS is unable to handle unicode characters in files uploaded into Moodle. This may result in not working Javascript on Moodle site (impossible to expand navigation, etc.) or broken CSS styles. | |||
See [http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configuring-the-fastcgi-extension-for-iis-60#utf8servervars Using UTF-8 Encoding for Server Variables] and [http://support.microsoft.com/kb/2277918/ How to get UTF-8 Encoding support in IIS 7.5 in Windows 7 and Windows Server 2008 R2 with the KB 2277918 hotfix]. | |||
Execute: | |||
<code> | |||
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO | |||
</code> | |||
===CGI timeouts=== | ===CGI timeouts=== | ||
Line 59: | Line 83: | ||
==Debugging problems== | ==Debugging problems== | ||
By default, IIS | By default, IIS uses custom error pages that intentionally hide error details on production sites: | ||
[[Image:scratch1_77F5DD11.jpg|frame|center|IIS default error message]] | |||
But when you're diagnosing problems in Moodle that's not very useful. You can temporarily disable these default error messages in IIS so that you see a specific Moodle error message. To achieve that set the "existingResponse" setting for Custom Error Pages in IIS to “PassThrough” for your Moodle site. The result will be that Moodle displays a more specific message about the error when a problem occurs: | |||
[[Image:scratch2_243263F6.jpg|frame|center|Useful error message]] | |||
The generic IIS "404" error message which normally does not reveal any details about the problem will no longer be displayed. | |||
The debugging option in ''Settings>Site administration>Development>Debugging'' should also be enabled so that you see the debug messages. | |||
== See also == | == See also == | ||
Line 67: | Line 98: | ||
* [http://en.wikipedia.org/wiki/Internet_Information_Services Wikipedia article on IIS] | * [http://en.wikipedia.org/wiki/Internet_Information_Services Wikipedia article on IIS] | ||
* [http://php.iis.net/ PHP installer for IIS] | * [http://php.iis.net/ PHP installer for IIS] | ||
* [http://blogs.iis.net/kehand/archive/2009/08/09/php-and-custom-error-pages.aspx Kern Handa's blog post about IIS error messages] | |||
[[ja:IIS]] | [[ja:IIS]] |
Latest revision as of 14:10, 30 August 2018
Internet Information Services (IIS) is the web server software bundled with Windows Server, as well as certain client versions of Windows. Please note Apache web server has much better community support and there are usually fewer problems when running Moodle on Apache. Windows OS is not suitable for large installations because PHP is limited to 32bit even in 64bit Windows, please consider using Linux or other unix-like operating systems instead.
IIS installation steps (Windows 7 and above)
- Go to Control panel, click on Programs and Turn Windows features on or off
- Tick "Internet Information Services" and "Internet Information Services / Application Development Features / CGI"
- Install Microsoft Web Platform Installer
PHP installation steps
It is strongly recommended to use only the official MS Platform installer, it automatically installs all necessary components and facilitates easy configuration with PHP manager. Manual installation attempts often fail or may not allow Moodle to function properly. Unfortunately MS does not usually distribute up-to-date version of PHP, you may need to download them manually.
- Install Microsoft Web Platform Installer
- Install latest PHP 5.6.5 or above using Web Platform Installer
- [Optional] Install URL Rewrite 2.0 using Web Platform Installer
Optionally you may install the required components manually:
- Download PHP manager for IIS and install it
- Download latest PHP 5.6.5+ VC11 x86 Non Thread Safe from http://windows.php.net/download/
- Extract the Zip file to a directory such as C:\PHP\
- Install the Visual C++ Redistributable for Visual Studio 2012 [1] - on 64bit Windows install both x86 and x64
- Open the Internet Information Service (IIS) Manager - right click on This computer and select Manage
- Click on PHP Manager icon
- Register new PHP version - select C:\PHP\php-cgi.exe
Warning: PHP needs to be configured via FastCGI in IIS, older CGI interface is known to have problems with some file names.
PHP configuration steps
- Set PHP configuration to values recommended by PHP Manager
- Enable required extensions in the PHP manager: php_intl.dll, php_pgsql.dll
- Enable OPcache extension
- Set your timezone in PHP.ini
- Set appropriate memory limits in PHP.ini
IIS configuration steps
- Setup URL rewriting described below
- Configure IIS to show detailed error pages.
- Set very long CGI timeout - 1 hour or better more.
- In IIS Manager add Moodle dirroot directory as a new virtual directory or set it as site directory
Slasharguments
The function slash arguments is required for various features in Moodle to work correctly, as described in Using slash arguments.
IIS 7 should support relative path arguments by default. If it does not work try enabling the following in php.ini
cgi.fix_pathinfo = 1
URL rewriting
If you can not modify registry as described below you may try manual configuration of rewrite rules, the PHP installation via Microsoft Web Platform Installer installs necessary URL Rewrite 2.0 module.
Add following rewrite rule to enable support for unicode file names in Moodle and to work around internal file length limitation breaking YUI file serving:
- Matches the Pattern - Regular Expressions -
^([^\?]+?\.php)(\/.+)$
- Action - Rewrite -
{R:1}\?file={R:2}
- Append query string - enabled
- Stop processing of subsequent rules - enabled
Optional UTF-8 file name fix
By default IIS is unable to handle unicode characters in files uploaded into Moodle. This may result in not working Javascript on Moodle site (impossible to expand navigation, etc.) or broken CSS styles.
See Using UTF-8 Encoding for Server Variables and How to get UTF-8 Encoding support in IIS 7.5 in Windows 7 and Windows Server 2008 R2 with the KB 2277918 hotfix.
Execute:
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO
CGI timeouts
By default IIS is configured to stop execution of any PHP script after 5 minutes of activity, this interferes with long running Moodle scripts such as upgrade or cron. The timeout should be increased to at least one hour.
Directory permissions
The default IIS account is IIS_IUSRS, make sure it has appropriate access right to Moodle dirroot (read only) and dataroot (read/write) directories.
Debugging problems
By default, IIS uses custom error pages that intentionally hide error details on production sites:
But when you're diagnosing problems in Moodle that's not very useful. You can temporarily disable these default error messages in IIS so that you see a specific Moodle error message. To achieve that set the "existingResponse" setting for Custom Error Pages in IIS to “PassThrough” for your Moodle site. The result will be that Moodle displays a more specific message about the error when a problem occurs:
The generic IIS "404" error message which normally does not reveal any details about the problem will no longer be displayed.
The debugging option in Settings>Site administration>Development>Debugging should also be enabled so that you see the debug messages.