Moodle 2.0 on Windows, IIS, MSSQL
Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Moodle 2.0 on Windows, IIS, MSSQL.
Note: This text describes installing Moodle using the third-party installer WebMatrix. Support for such third party installers may be limited or non-existent in the Moodle support forums. Please consider this when choosing this method.
Bold textby Rubens Ramos (email@example.com)
This is a contribution for who wants to install Moodle 2.0 on Windows environment. It´s is applied to Windows Vista or Windows 7, IIS 7 ou 7.5, and MS SQL Server 2008R2.
Although there´s a lot of ways to do it, I suggest the easy way, deploying WebMatrix.
This doc is based on contents available in the sites cited on jan/20/2011.
It is assumed you are using Windows Vista or Windows 7.
What you need, where to find it, how to get it
1.1 IIS 7 (or 7,5 in this case), MSSQL Server 2008 R2
Although you can install each one by yourself, you will find far more easy to use the tools from Microsoft IIS.net site.
Save WPI and run (or run directly). Follow the usual install instructions and install the basics for the website (you can install more later).
After installing, you should have, at least:
MSSQL Compact Database
MS SQL Server Express 2008R2 (if not, install after running WebMatrix). This version (Express) support a 10 GB moodle site. It´s a lot considering that main part of data is on moodledata. You can easily install multiples instances of moodle, for example, one for each school, 10GB each. You can install as many databases you want. But, if you need more than 10 GB in each database, you can get a normal edition of SQL Server 2008R2. It´s up to you.
1.2 Moodle Standard Package
Of course, you need moodle 2.0.
Go to moodle download area and get the latest release, like this 
Save it, unzip it. As an usual recipe, keep it aside.
1.3 MSSQL connector for PHP
Get the MS driver for MSSQL in PHP.
Go to . Download it, run it. It will unzip the dlls for the PHP extension that enable the MSSQL native driver for PHP.
Keep it aside for a moment.
2.1 Let´s start
Go to Start and look for the Microsoft WebMatrix entry. Click on it.
WebMatrix install the WebSite1 for default. You can use it or create other.
Let´s use it. But first, let do some hack.
Just for now, take a look in the site folder located in your Documents/My We Site.
Also, take a look also where IIS Express is located, the Program Files/IIS Express folder.
You will use these folders to deploy moodle 2.0 on IIS+MSSQL
Back to track. If you do not click on My Sites, do it. Also, click on WebSite1.
2.2 Enabling PHP
Inside WebMatrix window, click on Site > Settings and mark the Enable PHP. Let´s start with PHP 5.2. Follow the install instructions, wait a moment and done, now you can run PHP on IIS 7.5!
2.3 The SQL Server
If you do not install MS SQL Express 2008R2 yet, do it now. Let´s check. Click on Databases and see if the <install> icon in <SQL Server> area is enable. If it is not, then MS SQL Server Express 2008R2 is already installed. But, if you can click on it, just do it and install SQL Server Expess 2008R2. As usual, follow the instructions. Take care in remembering the sa password. The sa is the root/admin user usually used in MS SQL Servers. Take note of the user (sa) and the password (that you set it). It will be neccessary for the moodle installation.
You are almost there. Let WebMatrix open.
Enabling PHP MSSQL driver in IIS
3.1 Copying the driver to php/ext folder
Remember where you unzipped the PHP MSSQL driver.
Find php_sqlsrv_52_nts_vc6.dll and copy it to
Program Files/IIS Express/PHP/v5.2/ext
3.2 Enabling MSSQ driver in php.ini
Open the notepad as administrator.
In notepad, open the php.ini file located at Program Files/IIS Express/PHP/v5.2 (look for all files).
In php.ini, scroll down all the file and look for the extensions session in the end.
Just for simplicity, write a new line after the last extension= line you found. Write tis:
That´s right, as usual in php environment.
3.3 Put it to work
Go to WebMatrix and click on Restart. Done! Now PHP understand MS SQL Server.
Installing Moodle 2.0
4.1 moodle files
Copy the complete moodle folder that you unzipped from the standard package you´ve downloaded to the Documents/My Web Sites/Web Site 1/
Go to WebMatrix window, click on Files and with the mouse over the file trees, clik with right button and choose refresh. You should see the moodle folder. Click on the moodle folder and you can see all the files of moodle installation.
Create an empty folder named moodledata (or other if you want) in the Program Files/My Web Sites/ folder.
Note: do not create it under the WebSite1 folder. It is not work because moodle 2.0 install procedure will not permits moodledata being visible over the web.
4.3 Create moodle SQL database
In the WebMatrix window, choose Databases
Click on Add a database to your site. Rename it to moodle.
Clik on the database you´ve renamed (moodle) and click on Migrate. Let as Windows Autenthication.
You should now have a typical SQL server icon for database before moodle.
You have now a moodle empty SQL Server Express 2008R2 database.
4.4 Install moodle 2.0
In the WebMatrix window, click on Site and look for the URL. Click on it. After the browser had openned it, put /moodle in end of the url and you will get the first page of moodle install.
Choose a languange and NEXT.
Confirm Paths, actually, only make yourself sure about the name of the moodledata folder. NEXT.
Choose SQL Server Microsoft (native/mssql) database driver. NEXT.
In the page of database settings, set
Database host: localhost\sqlexpress
Database name: moodle
Database user: sa
Database password: (your pass of SQL Server)
Table prefix: let as is (mdl_)
Ok. Foollow the next pages instructions, and after the end you will find yourself with a moodle site as usual (2.0 in this case), but using: Windows Vista/7 IIS 7.5 PHP MS SQL Server
As you can realize now, all the moodle data in the MS SQL Server is accessible to you by a lot of ways, including MS Word, MS Excel, MS PowerPoint and so on.
You can also create ASP or ASPX pages and get data from the moodle SQL Server database for a lot of purpose, like generate special reports, tables, etc.
As IIS 7.5 (and 6 and 7) can keep PHP, ASP, and ASPX side by side, you can have pages with, for instance, ASPX and moodle inside!
You can easily integrate users from moodle in others areas of the site.
Or, you can also start doing more, like building stored procedures for special purposes, like getting grades from moodle to feed the grade school regular grade system in other program.
I´ve used here IIS 7.5 Express and MS WebMatrix to demonstrate how to deploy a Moodle site running in IIS, PHP, MS SQL Server.
Although IIS 7.5 Express cannot run as a service, what means that you have to start it with WebMatrix or alone (as far as I know now), the procedure illustrated here is similar for usin a regular IIS 7 or IIS 7.5 server. The MS SQL Server Express is the same as the normal release. The PHP install changes a little bit, but there´s a windows installer for the PHP in PHP.net here .
See the main difference of IIS Express and a regular IIS here