Moodle (Modular Object-Oriented Dynamic Learning Environment) is a popular learning management system (LMS) used by educators worldwide. Setting it up on XAMPP (an Apache distribution for PHP and MySQL) provides a cost-effective and efficient way to experiment, develop, and manage your LMS locally. This guide walks you through every step of the process, from installation to development.
1. Prerequisites
Before diving into the setup, ensure you have the following:
- A computer with Windows, macOS, or Linux: Ensure your system meets the minimum hardware requirements.
- XAMPP installed: Download it from Apache Friends. Make sure you choose the version that supports PHP 7.4 or higher, as Moodle requires it.
- Moodle installation package: Obtain the latest stable version from Moodle.org. Download the .zip or .tgz file.
- Text Editor: Use a reliable text editor like Notepad++ or Visual Studio Code for editing configuration files.
2. Installing XAMPP
- Download XAMPP:
- Go to Apache Friends.
- Choose the appropriate version for your operating system.
- Install XAMPP:
- Run the downloaded installer file.
- Follow these steps during installation:
- Select the components: Ensure Apache, MySQL, PHP, and phpMyAdmin are checked.
- Choose the installation directory (default:
C:\xampp
). - Complete the installation by following the prompts.
- Verify Installation:
- Open the XAMPP Control Panel.
- Start the Apache and MySQL modules by clicking Start.
- Test the installation by visiting
http://localhost/
in a browser.
3. Configuring XAMPP for Moodle
- Locate the php.ini File:
- Open the XAMPP Control Panel.
- Click on Config next to Apache and select php.ini.
- Modify PHP Settings: Update the following values in
php.ini
to meet Moodle’s requirements:max_execution_time = 300
post_max_size = 128M
upload_max_filesize = 128M
memory_limit = 512M
- Save and Restart Services:
- Save the changes to
php.ini
. - Restart Apache and MySQL from the XAMPP Control Panel.
- Save the changes to
4. Setting Up a Database for Moodle
- Access phpMyAdmin:
- Open your browser and go to
http://localhost/phpmyadmin
.
- Open your browser and go to
- Create a New Database:
- Click on the Databases tab.
- Enter a name for your database (e.g.,
moodle_db
). - Choose utf8mb4_unicode_ci as the collation for compatibility with Moodle.
- Click Create.
- Create a Database User:
- Go to the User Accounts tab.
- Click Add User Account.
- Fill in the following details:
- Username: e.g.,
moodleuser
- Host:
localhost
- Password: Choose a secure password.
- Username: e.g.,
- Under Global Privileges, check Check All to grant full access.
- Click Go to save.
5. Installing Moodle
- Extract Moodle Package:
- Locate the downloaded Moodle package.
- Extract it using tools like WinRAR or 7-Zip.
- Move the extracted folder to
\xampp\htdocs\
. - Rename the folder to
moodle
.
- Run Moodle Installation:
- Open your browser and navigate to
http://localhost/moodle
. - Follow the installation wizard:
- Select your preferred language.
- Verify the server checks to ensure all requirements are met. Fix any issues before proceeding.
- Open your browser and navigate to
- Database Configuration:
- Provide the following details:
- Database type: MySQL.
- Host:
localhost
. - Database name:
moodle_db
. - Username:
moodleuser
. - Password: Enter the secure password you created.
- Click Next to proceed.
- Provide the following details:
- Complete Installation:
- Set up the Moodle admin account, including username, password, and email.
- Configure the site name, description, and timezone.
6. Post-Installation Configuration
- Relocate moodledata Folder:
- Move the
moodledata
folder from\xampp\htdocs\
to a directory outside the webroot (e.g.,C:\moodledata
). - Ensure it has proper read/write permissions.
- Move the
- Edit Moodle Configuration File:
- Open
config.php
in themoodle
folder. - Update the
$CFG->dataroot
path to reflect the newmoodledata
location.
- Open
- Set Up Cron Jobs:
- Create a batch file containing:
php C:\xampp\htdocs\moodle\admin\cli\cron.php
- Schedule the batch file to run at regular intervals using Task Scheduler.
- Create a batch file containing:
7. Developing with Moodle
- Customizing Themes:
- Go to Site Administration > Appearance > Themes.
- Install new themes or modify existing ones to match your branding.
- Installing Plugins:
- Visit Site Administration > Plugins > Install Plugins.
- Upload plugins from the Moodle Plugin Directory to extend functionality.
- Creating Courses:
- Go to Site Administration > Courses > Add a New Course.
- Set course details such as name, description, and format.
- Add activities and resources to build your curriculum.
8. Troubleshooting Tips
- Apache or MySQL Not Starting:
- Check if ports 80 or 443 are in use by another application. Reconfigure the ports in XAMPP if needed.
- Database Connection Errors:
- Verify the database credentials in
config.php
. - Ensure the MySQL service is running.
- Verify the database credentials in
- PHP Errors:
- Review the PHP error logs located in
\xampp\php\logs\
. - Increase memory limits or execution times in
php.ini
if needed.
- Review the PHP error logs located in
- Permission Issues:
- Ensure
moodledata
has correct read/write permissions.
- Ensure

Moodle 4 Administration: An administrator’s guide to configuring, securing, customizing, and extending Moodle, 4th Edition
9. Conclusion
By following this comprehensive guide, you have successfully set up Moodle LMS on XAMPP. This local installation allows you to experiment with features, customize settings, and develop a personalized e-learning platform for your needs.
See Also
-
The Best Website Monitoring Tools to Keep Your Site Running Smoothly
-
XAMPP for Moodle: Learn to install, configure, and develop Moodle LMS locally with this step-by-step guide for seamless setup.
-
Step-by-Step Guide to Installing XAMPP and Configuring WordPress Like a Pro
-
XAMPP Web Server vs. WAMP: Which One is Right for Your Web Development?
-
Effortless WordPress Deployment: A Complete Guide with Bitnami Application
-
Full Stack Web Development: Skills, Tools, and Career Opportunities
-
The Ultimate Beginner’s Guide to Understanding Domain and Hosting
-
How Cloudflare Supercharges Your Website: The Ultimate Guide to Speed and Security
-
The Ultimate Guide to Stress-Free Website Project Management
-
Master Google Search Console: A Complete Guide for Boosting Your Website’s Performance
-
How Search Engines Work: The Complete Guide