How to install Moodle in Windows
This tutorial is specifically for installing Moodle in Windows. The complete stack – Apache, MySQL, PHP and Moodle will be shown here.
There are 2 ways this can be done.
- The AUTOMATED but less powerful way. I have a separate tutorial for this.
- The MANUAL but more powerful way. Read on for this.
The Manual, Clean and Powerful way to Install Moodle on a Windows Machine
Step 1: INSTALL APACHE web server
Step 2: INSTALL PHP
Step 3: INSTALL MySQL
Step 4: INSTALL Moodle – see instructions below
PREP WORK BEFORE INSTALLING MOODLE:
1: Download Moodle package from Moodle.org site.
At the time of creating this page, the latest stable release is Moodle 3.1.3+. You can also find earlier versions also.
2. Unzip the Moodle package.
You will find a folder called “Moodle” inside the compressed package. Copy the “Moodle” folder into the “<Apache>/htdocs” folder on your computer.
Your file structure should look something like this:
3. Create an empty database schema in your database server.
You can use any suitable tool for doing this – for example through phpMyAdmin tool or through the MySQL Workbench which you would have installed when installing MySQL.
I have given a name “moodle3db” to the new schema. Name needs to be in small cases.
4. Some changes have to be made to the “PHP.ini” file next.
First locate this file. This will be in your PHP folder wherever you have installed it. In my case this is “c:\PHP\”.
Open this file in a pure ASCII based text editor. Do not use something like MS Word – which will mangle the text.
In PHP.ini file search for a parameter called “extension_dir”.
Make sure that this contains the full and correct path – see my example in the screenshot above. This is to prevent file location errors in the future.
Furthermore, we will have to enable a few DLL extensions. Search for “Windows Extensions” in the PHP.ini file.
You will see a lot of extensions given – and by default many of them will be commented out with the “;” character.
You will have to remove the “;” char for the lines indicated next.
Enable for “php_curl.dll”, “php_gd2.dll”, “php_intl.dll”, “php_openssl.dll”, “php_soap.dll”, “php_xmlrpc.dll” and most importantly “php_mysqli.dll“.
5. Add “c:\PHP” (path to your own PHP installation) is in the computer’s PATH variable – if not already there.
You can do this from your Control Panel. “System –> Advanced System Settings –> Advanced –> Environment Variables” link.
Be very careful with this – do not muck up the existing path – or it will break other applications on your computer. See the video for this lesson if you are unsure how to modify path variable.
6. Restart Apache from the command prompt. You will do this to ensure changes you made in the PHP.ini file to now start being effective.
Run the command prompt as Administrator.
Use the command “httpd -k restart”
I have used the “stop” and “start” command parameters – both techniques are fine.
7. YOU ARE NOW READY TO START INSTALLING MOODLE.
8. Start Moodle installation.
Open a new browser window and in the address bar, type “http://localhost/moodle”, you should see Moodle’s installation wizard start like below, if you have done everything correctly so far –
Note: localhost denotes your local computer.
9. Select the language of your choice and proceed further.
10. Set the Moodle directory paths
This page has good information on different path configurations used by Moodle. Read through and understand this page.
11. Choose a database driver
Since you have installed MySQL as a part of this tutorial – you will want to choose that. If otherwise, then choose accordingly.
12. Enter all details required to connect with the database schema we had created earlier
You need not enter a tables prefix and a database port – they are optional.
13. Accept the copyright notice
If you have come so far – then you have passed through all the major hurdles. All necessary config files are in place, paths are correct – and Moodle has been able to connect to the database correctly.
In the next step, the actual installation scripts will kick in.
14. Opcache.enable warning can be ignored.
15. Moodle installer will now write to the database and do it’s background magic. Wait patiently until it returns back – maybe 5 mins or so.
16. Moodle Configuration screen.
At this stage installation has basically been completed. But the installer will now create the SUPER ADMIN account.
NOTE: Moodle requires your username to be all small chars. Carefully save this login detail someplace – this is your most powerful super-admin account.
17. IMPORTANT – you might get a page not found at this stage – after setting primary info
RESOLUTION: you have to empty out the MOODLEDATA folder.
18. Return back to the browser and load Moodle – http://localhost/moodle – you will get the login screen
19. Very first time you login, you will be asked to configure site details. You can always edit this at a later stage.
20. IMPORTANT: There are 3 things that will help you if you find errors during installation
- Follow instructions in this tutorial as closely as possible
- If you find an error – google the exact error string, adding “moodle” to your search. Almost every issue has a resolution
- Sometimes installation script will not complete – especially if you are on a slow computer. In that case, after waiting for a reasonable amount of time, just restart the installation. Moodle installer is designed to resume as intelligently as possible.
See this complete tutorial in Video: