While Linux and Apache remain a popular combination for Moodle installations, many administrators are turning to Moodle on Windows as a more familiar and user-friendly alternative. With the improvements in IIS (Internet Information Services) – Web Server bundled with Microsoft Server operating system, in terms of security, stability, and scalability, Moodle on Windows is becoming an increasingly viable option. However, for those already comfortable with the Windows environment, such as myself, who spent considerable time on Windows Server during my M.Sc. dissertation at The University of Manchester, the prospect of learning Linux and Apache from scratch can be daunting. This tutorial will guide you through setting up a Moodle server from scratch using Microsoft Server 2012 R2 with IIS 8.5, highlighting specific requirements for Moodle installation on Microsoft Windows Server environment.
Table of Contents
Server Hardware
Determining the ideal hardware requirements for a Moodle server can be a complex task, as everyone’s needs are unique. While it’s tempting to think that simply investing in a powerful CPU and ample RAM will suffice, the reality is that other factors, such as hard drive throughput, can quickly become a bottleneck. When it comes to running Moodle on Windows, finding the sweet spot for a high-performing server is crucial. According to Moodle’s documentation, a best practice is to separate your server’s operating system and swap file (or page file, in the case of a Windows server) onto one drive, while keeping your application server (PHP), Moodle, and database on a second drive. By optimizing your hardware configuration, you can ensure a seamless and efficient experience when running Moodle on Windows. Though this tutorial was created way back for Server 2012, the procedure for the latest version of windows server remains the same.
When it comes to setting up Moodle on Windows, one key consideration is the installation of IIS (Internet Information Services). Unlike LAMP (Linux, Apache, MySQL, and PHP) installations, where the web server can be installed on any drive, IIS is typically installed in the default directory alongside the operating system. This can be a limitation for Moodle on Windows administrators who want more flexibility in their server configuration. While it is technically possible to install IIS in a different directory by modifying the registry file, advice from IIS developers suggests that it’s generally best to keep IIS in its default location, where it can interact seamlessly with the operating system’s Dynamic Link Libraries (DLLs).
This being said, again referring to Moodle performance documentation, adding on top I would recommend adding another drive and keeping database on that independent drive, ideally an SSD (Solid State Drive) for the IOPS of SSD is far superior to traditional mechanical drive and in terms of Moodle’s installation the database read-write activity is tremendous. Therefore, your drive structure ideally should be as follows:
1st Drive (System Drive) | Holding O/S and Page/Swap File (Ideally SSD Drive) |
2nd Drive (Data Drive) | Holding Application server (PHP) and Moodle + Moodle Data files (depending on size of your Moodle files, you can go with Mechanical or SSD, where SSD’s performance will be far superior considering application will be running from this drive and Moodle stores cache in Moodledata) |
3rd Drive (Database Drive) | Database Drive – Best would be if SSD Drive is used for the IOPS of SSD Drive is far superior to traditional mechanical drives. Additionally, Moodle temp directory should as well be moved to SSD drive from moodledata folder. |
This above is recommended for one box solution, if you can do make use of RAID or if spending is not an issue, then keep database on a separate box for scalability.
If you are looking for a hosted solution, rather setting up in house server, then do consider Contabo hosting, for their prices are unbeatable and drives can be fully customizable.
Rest for enabling required and optional extensions, I have explained in Video, you can watch to learn more, I have as well discussed setting up and configuring OpCache extension, that will further enhance the memory usage and page render timing for your Moodle pages.
Downloads
Web server already comes as a part of Server operating system, additional downloads required are mentioned below with links to their respective sites.
- Moodle (Watch video for explanation of which package to download)
- PHP (Including Visual C++, version depends on PHP version selected)
- Database (I am using MariaDB, you can choose DB of your choice)
- PHP Manager (Not required, but highly recommended)
PHP Manager Update for Server 2012 & Server 2016 |
With regards to PHP Manager extension, a kind developer has updated versions for IIS 8/8.5 (PHP Manager 1.3 64-bit) and as well for IIS 10 (PHP Manager 1.4 64-bit), you can download these using links provided, not much has been added to these extensions, but I believe only versions numbers have been updated, for even the initial version 1.2 is working fine on IIS 10. Even if you cannot manage to download as this link has been asking for permissions lately and sometimes, I fail to read messages in good time, you will be able to find the manager (now officially supported by IIS.net) you can download version 1.5 HERE, and version 2.0 BETA HERE. |
PHP Settings

For administrators running Moodle on Windows, the recent release of PHP 7.0 is a game-changer. With its promise of nearly twice the performance of its predecessor, PHP 7.0 delivers significant gains for Moodle users. In fact, testing has shown that PHP 7.0 reduces rendering time by half, while using substantially less memory – in some cases, as little as one-tenth of the memory required by previous versions. With Moodle 3.0.1 and later versions officially supporting PHP 7.0, and numerous community members confirming its benefits, upgrading to PHP 7.0 is a highly recommended step for anyone running Moodle on Windows.
Either you can watch video and follow step by step in initialization of PHP, else to save time, copy and paste these few lines in the end of your php.ini file editing and deleting as required.
error_log="C:\php\php56\temp\"
upload_tmp_dir="C:\php\php56\temp\"
session.save_path="C:\php\php56\temp\"
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
max_input_vars =2000 */only applies if using PhpMyAdmin to manage databases/*
date.timezone=Europe/London
extension_dir= "C:\php\php56\ext\"
Rest for enabling required and optional extensions, I have explained in Video, you can watch to learn more, I have as well discussed setting up and configuring OpCache extension, that will further enhance the memory usage and page render timing for your Moodle pages.
Database
Thankfully with windows platform, user have plenty of database options like Microsoft’s own SQL Server comes with a free edition as well, ever popular MySQL, industry’s known PostgreSQL and also a fairly new addition of MariaDB that comes as a drop-in replacement of MySQL and is as well recommended by Moodle developers for the tests they have done comparing it to MySQL, MariaDB has shown improved results.
When running Moodle on Windows, choosing the right database is crucial. While Microsoft SQL Server is a viable option, I recommend using either MySQL or MariaDB, as they offer greater flexibility and compatibility with Linux-based platforms. This allows you to easily transfer your Moodle installation between Windows and Linux environments, simply by transferring folders. Between MySQL and MariaDB, I opted for MariaDB due to its more flexible installation options and lower memory usage – in my tests, MariaDB used less than 108 MB of memory, compared to over 400 MB for MySQL. When configuring your database, be sure to allocate sufficient buffer memory – MariaDB’s default is 12.5% of total system RAM, but you may be able to allocate more, depending on your system resources.
Do watch video for explanation of downloads where applicable. This below video will take you step by step in manually setting up your server, whilst second video will show setting up PHP using PHP Manager (an extension to IIS) making your job of setting up and managing PHP much easier.
Moodle installation Videos
Method 1: Moodle Server Set-up using MANUAL method
Method 2: Moodle Server setup using PHP Manager (Recommended Method)
This Video will show how to setup Moodle on Windows Server using PHP manager, which is a recommended method for keeping everything clean and managed, however I will still recommend going through above video as I have spent considerable time in that video in explanations.
Further recommend links in setting up Moodle on Windows server with IIS |
Setting up Cron Jobs (Scheduled Tasks) in Windows Moodle performance FAQ’s Setting up IIS – Moodle documentation Setting up OpCache in Moodle Converting Database tables from Antelope to Barracuda |