Please read this guide several times before acting upon its content.
- Microsoft Server 2008/2012 – Basic install, Name, Static IP, (updates if you like)
* Optional – Domain Joined or Standalone
- SQL 2012 Express with Management Studio www.microsoft.com
- Latest Non Thread Safe Installer x86 VC9 version of PHP from windows.php.net/download.
- PHP to Microsoft SQL connection dll files from wicher.co.uk/lil/0y or google Microsoft Drivers for PHP for SQL Server.
- Latest Moodle download.moodle.org/
- PHP Manager for IIS phpmanager.codeplex.com
This guide will not be covering windows firewall port configuration, instead for this install i suggest turning Windows firewall off. For configuring firewall ports please checkout the Moodle Forums over at moodle.org
Configuring Windows, Roles and Features
We will be using Microsoft Internet Information Service to publish our Moodle website.
- In Server Manager, Click on Add roles and features.
- Click Next for Installation Type, Select the server Next
- Click on Application Server and Web Server (IIS).
In Web Server (IIS), Role Services ensure the following extras are checked
- Application Development
- .NET Extensibility
- ISAPI Extensions
- ISAPI Filters
- Basic Authentication
Import-Module Servermanager Add-WindowsFeature Web-Server,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-CGI,Web-ISAPI-Ext,Web-Security,Web-Basic-Auth
Assuming you have already downloaded the latest installer VC9 of PHP
- Run the downloaded php MSI and install PHP to c:\php, click Next.
- For Web server Setup select IIS FastCGI, click Next.
- The default install will suffice for this install, click Next.
PHP Manager for IIS
- Run the downloaded PHPManagerForIIS-1.2.0 MSI file downloaded and follow the instructions.
Configuring PHP and IIS
- Open IIS Manage. On the left, click on the name of your server.
- Scroll down the page and you will find Handler Mappings under the IIS Group.
- Open Handler Mappings and click on Add Module Map… which is located down the right Hand side.
Fill in the form with the following information:
- Request path: *.php
- Module: FastCGIModule
- Executable: C:\php\php-cgi.exe
- Name: PHPviaFastCGI
- You will then be prompted if you want to allow this ISAPI and click Yes.
New Folders and Permissions
- Open up the c:\php folder and Create a new folder called sessions.
- Then create a new folder in inetpub folder called moodledata.
- Repeat next three steps on both sessions and moodledata folders just created.
- Right click on the new folder and select properties.
- Click Security tab, Edit then Click Add.
- Search for user IUSR, click ok then give IUSR Full Permissions.
Configure the PHP.ini
There are some settings that need to be changed within the php.ini file in c:\php
- Open php.ini in notepad or preferably for me Notepad++
- Search for and add upload_tmp_dir and session.save_path to = c:\php\sessions.
- Now search for doc_root and add the location of your wwwroot folder. Normally c:\inetpub\wwwroot but as i am having my moodle data stored on another drive i’ve set mine to: doc_root = d:\inetput\wwwroot
- Search for ;cgi.fix_pathinfo then remove the ;
- Search for ;cgi.force_redirects = 1 and remove the ;
- Last, at the bottom add: extension=php_sqlsrv_53_nts_vc9.dll
- Save the file and close.
Testing IIS and PHP Configuration
Open Notepad and paste the following code and save into the wwwroot folder c:\inetpub\wwwroot as phptest.php
- First off just need to reset IIS after all the changes we have made by running PowerShell command: iisreset
- Open web browser and go the following url: http://127.0.0.1/test.php
- Now if everything is working as it should you will see at the top the title of the PHP version you installed.
- Search for session.save_path and check it has location set to c:\php\sessions
- Run setup.exe and start the install of SQL Server stand-alone..
Install the following Features:
- Database Engine Services
- SQL Server Replication
- Full-Text Search
- Management Tools – Basic
- Management Tools – Complete
- Select Default instance, Next
- Add your SQL account you wish to use for both Database Engine and Reporting Services. (I’m sure best practice would say make a separate new user account for this, up to you) Press Next
- For Database Engine Configuration choose Mixed Authentication and add the SQL service account to administrators.
- Click Next and watch it install or make a coffee(hmmm)
Moodle will when first run populate the database we just need to first make it.
- Open SQL Server Manager Studio and log into the Database Engine.
- Create a new SQL User by expanding the Object Explorer, Security then expanding Logins. Right Click on Logins and click New Login.
- Create a new user called moodle_user.
- Select SQL Server authentication, then give it a password.
- Untick Enforce password policy
- Expand Object Explorer, and right click on Databases.
- Set Database name to moodle_DB.
- Click the … right of Owner, click Browse and select moodle_user.
- OK, OK.
- Under Select a page, click options. Under Miscellaneous Change ANSI NULLS Enabled to True and Quoted Identifiers Enabled to True
- Click OK to create the database.
- Right Click the new moodle_DB database and click Properties.
- Click Options under Select a page
- Make sure the Compatibility level is SQL Server 2008 (100), if not click the drop down and change it.
- Click OK to save.
Pipes and TCP/IP
- Open SQL Server Configuration Manager.
- Expand SQL Server Network Configuration.
- Enable Both Named Pipes and TCP/IP.
Connect SQL and PHP dll
- Run the Microsoft dll exe downloaded and extract the content some place easy accessable.
- Navigate to the extracted folder and copy php_sqlsrv_53_nts_vc9.dll to c:\php\ext
- Extract the downloaded moodle file to the inetpub\wwwroot folder
- Open web browser and navigate to http://127.0.0.1
- This will open moodle installation page.
- Choose English or what ever language the installations for.
- Check the directories are correct then click next.
- Moodle will input the paths for you, if you get an error check the folder permissions. Next.
- Select *Server Microsoft (native/sqlsrv) and click Next. Ensure that you have the 2008 r2 native client installed. Next.
- Database host: 127.0.0.1
- Database name: moodle_DB
- Database user: moodle_user
- Database password: **********
Moodle will now create a file called config.php within inetpub\wwwroot if you receive an error check folder permissions for user IUSR. and follow the red warning message on manually creating config.php
- Click Next and follow the installation.
- Once installed it will open the admin account page. Fill all the fields and pick a good strong memorable password.
Once you have made the admin account it will finish the install. you will now have a working moodle VLE.
- Navigate to inetpub\wwwroot and open config.php with notepad. This file holds the database name and password for moodle SQL but also has the wwwroot url the VLE will use. for the above setup it will be http://184.108.40.206 but you could change this value to http://**ServerName** or with some quick DNS work what ever url you would like.