Note: You are currently viewing documentation for Moodle 2.5. Up-to-date documentation for the latest stable version of Moodle may be available here: Internet Information Services.

Internet Information Services: Difference between revisions

From MoodleDocs
m (Missing some important potential IIS account names depending on your version of IIS)
 
(9 intermediate revisions by 2 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.
{{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.


==PHP installation==
==IIS installation steps (Windows 7)==


It is strongly recommended to use only the official Microsoft PHP installer from http://php.iis.net/, 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.
# 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 [http://www.microsoft.com/web/downloads/platform.aspx Microsoft Web Platform installer]


==Configuration==
==PHP installation steps==


Unfortunately IIS does not natively support unicode characters in so called ''slashargument URL'' which are used in Moodle for file serving. Moodle requires manual configuration of rewrite rules, the PHP installation via ''Microsoft Web Platform Installer'' installs necessary ''URL Rewrite 2.0'' module.
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.
 
# Manually download [http://phpmanager.codeplex.com PHP manager for IIS] or use the [http://www.microsoft.com/web/downloads/platform.aspx Miscrosoft Web Platform installer] and install it
# Download latest PHP 5.5.x VC11 x86 Thread Safe from [http://windows.php.net/download/ http://windows.php.net/download/] (you may also try the Non Thread Safe version)
# 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
# Click on PHP Manager icon
# Register new PHP version - select C:\PHP\php-cgi.exe
 
'''Warning: PHP needs to be configured via FastCGI, older CGI interface is known to have problems with some file names.'''
 
==PHP configuration steps==
 
# 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
 
==More configuration hints==
 
===Slasharguments===
 
IIS 7 should support relative path arguments by default, if it does not work try enabling following in your php.ini
 
cgi.fix_pathinfo = 1
 
===Fix UTF-8 file names===
 
By default IIS is unable to handle unicode characters in files uploaded into Moodle.
 
See http://support.microsoft.com/kb/2277918.
 
Execute:
<code>
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO
</code>
 
===URL rewriting workaround===
If you can not modify registry as described above 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]]


Add following rewrite rule to enable support for unicode file names in Moodle:
 
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 - <code>^([^\?]+?\.php)(\/.+)$</code>
* Matches the Pattern - Regular Expressions - <code>^([^\?]+?\.php)(\/.+)$</code>
* Action - Rewrite - <code>{R:1}\?file={R:2}</code> - Append query string
* Action - Rewrite - <code>{R:1}\?file={R:2}</code>
* Append query string - enabled
* Stop processing of subsequent rules - enabled
 
===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==
==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.
The default IIS account is ''IIS_IUSRS'' or ''IUSR'' in IIS7, or ''IUSR_MachineName'' in older versions of IIS. Make sure the account has appropriate access rights to Moodle dirroot (read only) and dataroot (read/write) directories.


==Debugging problems==
==Debugging problems==


By default IIS contains custom error pages that intentionally hide error details on production sites. When diagnosing problems you may want to disable temporarily the IIS Error Pages.
By default, IIS contains custom error pages that intentionally hide error details on production sites. When diagnosing problems you may want to disable temporarily the IIS Error Pages so you can see Moodle specific error messages, alongside enabling debugging in ''Settings>Site administration>Development>Debugging''. This [http://blogs.iis.net/kehand/archive/2009/08/09/php-and-custom-error-pages.aspx blog post about IIS error messages] explains how to get more useful error messages when using IIS.


== See also ==
== See also ==

Latest revision as of 22:13, 4 April 2014

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)

  1. Go to Control panel, click on Programs and Turn Windows features on or off
  2. Tick "Internet Information Services" and "Internet Information Services / Application Development Features / CGI"
  3. 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 distribute up-to-date version of PHP, you need to download them manually.

  1. Manually download PHP manager for IIS or use the Miscrosoft Web Platform installer and install it
  2. Download latest PHP 5.5.x VC11 x86 Thread Safe from http://windows.php.net/download/ (you may also try the Non Thread Safe version)
  3. Extract the Zip file to a directory such as C:\PHP\
  4. Install the Visual C++ Redistributable for Visual Studio 2012 [1] - on 64bit Windows install both x86 and x64
  5. Open the Internet Information Service (IIS) Manager - right click on This computer and select Manage
  6. Click on PHP Manager icon
  7. Register new PHP version - select C:\PHP\php-cgi.exe

Warning: PHP needs to be configured via FastCGI, older CGI interface is known to have problems with some file names.

PHP configuration steps

  1. Enable required extensions in the PHP manager: php_intl.dll, php_pgsql.dll
  2. Enable OPcache extension
  3. Set your timezone in PHP.ini
  4. Set appropriate memory limits in PHP.ini

IIS configuration steps

  1. Setup URL rewriting described below
  2. Configure IIS to show detailed error pages.
  3. Set very long CGI timeout - 1 hour or better more.
  4. In IIS Manager add Moodle dirroot directory as a new virtual directory or set it as site directory

More configuration hints

Slasharguments

IIS 7 should support relative path arguments by default, if it does not work try enabling following in your php.ini

cgi.fix_pathinfo = 1

Fix UTF-8 file names

By default IIS is unable to handle unicode characters in files uploaded into Moodle.

See http://support.microsoft.com/kb/2277918.

Execute: reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO

URL rewriting workaround

If you can not modify registry as described above you may try manual configuration of rewrite rules, the PHP installation via Microsoft Web Platform Installer installs necessary URL Rewrite 2.0 module.

Rewrite rule - Internet Information Services (IIS) Manager.png


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

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 or IUSR in IIS7, or IUSR_MachineName in older versions of IIS. Make sure the account has appropriate access rights to Moodle dirroot (read only) and dataroot (read/write) directories.

Debugging problems

By default, IIS contains custom error pages that intentionally hide error details on production sites. When diagnosing problems you may want to disable temporarily the IIS Error Pages so you can see Moodle specific error messages, alongside enabling debugging in Settings>Site administration>Development>Debugging. This blog post about IIS error messages explains how to get more useful error messages when using IIS.

See also