How to Install Drupal Locally with XAMPP on Windows 11

Want to build and test a website on your own Windows 11 computer? You can install Drupal — a popular website builder — without needing the internet. This guide shows you how to set up Drupal using XAMPP. XAMPP is a free program that creates a web server right on your PC.

What is XAMPP?

XAMPP is free software that has everything you need to run websites on your computer. It includes:

  • Apache (the web server that displays your website)
  • MariaDB (a database that stores your website’s information)
  • PHP (the programming language that Drupal uses)

With XAMPP, you can run Drupal and other websites without needing an internet connection.

Step 1: Install XAMPP

Don’t have XAMPP yet? Follow this guide first:

How to Install XAMPP on Windows 11

Step 2: Create a Database for Drupal

Why? Drupal needs a place to save all your website information. That place is called a database.

What you’ll do:

  1. Open the XAMPP Control Panel.
  2. Click the Shell button on the left side. A command window will open.
  3. Type this command and press Enter to open the database tool:

    mysql -u root
  4. Type these commands one at a time. Press Enter after each one. Replace your_password_here with a password you choose. Remember this password!

    CREATE DATABASE drupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;


    CREATE USER 'drupaldbuser'@'localhost' IDENTIFIED BY 'your_password_here';


    GRANT ALL ON drupaldb.* TO 'drupaldbuser'@'localhost';


    FLUSH PRIVILEGES;


    exit

XAMPP Shell Button

Tip: If you don’t want to use the command line, you can create the database using phpMyAdmin instead. Click the Admin button next to MySQL in the XAMPP Control Panel.

Step 3: Download and Prepare Drupal

What you’ll do:

  1. Open your C:\xampp\htdocs folder on your computer.
  2. Create a new folder called drupal inside the htdocs folder. This is where your Drupal files will go.
  3. Download the latest Drupal version from here: Drupal Downloads
  4. Extract the Drupal files you downloaded directly into the drupal folder.
Drupal folder inside XAMPP htdocs

Step 4: Change Apache’s Default Page to Your Drupal Site

Why? By default, XAMPP shows a dashboard page when you open your local server. We want it to go straight to Drupal instead.

What you’ll do:

  1. Go to C:\xampp\htdocs and open the index.html file with a text editor like Notepad.
  2. Replace everything in the file with this code:

    <?php

      if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {

        $uri = 'https://';

      } else {

        $uri = 'http://';

      }

      $uri .= $_SERVER['HTTP_HOST'];

      header('Location: '.$uri.'/drupal/');

      exit;

    ?>

    Something is wrong with the XAMPP installation :-(

  3. Save the file.

Step 5: Restart Apache

What happens when you do this? Apache will apply the changes you just made.

What you’ll do:

  1. Go back to the XAMPP Control Panel.
  2. Stop Apache by clicking the Stop button.
  3. Start Apache again by clicking the Start button.

Step 6: Start Drupal Installation

What you’ll do:

  1. Open your web browser and go to: http://localhost
  2. You should see the Drupal setup page.
  3. Choose your language and click Save and continue.
  4. Select the installation type (usually “Standard” works fine) and continue.
  5. Enter the database information you created earlier:
    • Database name: drupaldb
    • Username: drupaldbuser
    • Password: (the password you chose in Step 2)
    • Database host: leave this as localhost
  6. Continue and fill in your website’s name.
  7. Create an admin username and password for yourself.
  8. Finish the setup. You now have your own Drupal site running locally!
Drupal choose language step

Drupal installation profile step

Drupal database entry step

Drupal site configuration step

Drupal setup complete

Summary

  • Install XAMPP on your Windows 11 computer.
  • Create a database and user for Drupal using XAMPP’s Shell or phpMyAdmin.
  • Download Drupal and put the files in a drupal folder inside htdocs.
  • Change the default page to redirect to Drupal.
  • Restart Apache to apply the changes.
  • Open your browser at http://localhost to complete Drupal setup.

You now have Drupal running on your computer! You can build and test your website safely before going live on the internet.

Fediverse reactions

Categories:

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version