Internet Information Services: Difference between revisions
Line 20: | Line 20: | ||
==PHP configuration== | ==PHP configuration== | ||
# Enable | # Enable required extensions in the PHP manager: php_intl.dll, php_pgsql.dll | ||
# Enable [[OPcache]] extension | |||
# | # | ||
Revision as of 06:21, 27 November 2013
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.
IIS installation in Windows 7
- 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"
PHP installation
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.
- Download and install PHP manager for IIS or use the
- Download latest PHP 5.5.x 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 x86 or x64 - on 64bit Windows install both versions
- 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
PHP configuration
- Enable required extensions in the PHP manager: php_intl.dll, php_pgsql.dll
- Enable OPcache extension
IIS configuration
- Execute as administrator:
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO
- disable IIS error pages
- set very long CGI timeouts
Configuration
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.
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, make sure it has appropriate access right 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.