Quick install Drupal with XAMPP on Windows

Last updated on
12 February 2018

This guide shows how you can install XAMPP on Windows (e.g. Win 7. Win 8.x,  or Win 10, 32 bit or 64 bit) to use as a development environment for Drupal.

Important Safety Notice:

XAMPP should not be used for a web server that can be accessed from the Internet. The safe operation of the web server is not guaranteed with XAMPP!

Step 1: Install XAMPP as a development environment (1)

  1. Download XAMPP from Apache Friends. Choose the download with the version of PHP that you need (see the Drupal PHP system requirements). If in doubt, take the latest XAMPP for Windows.
  2. Double-click on the downloaded .exe file.
    • If you get a User Account Control prompt, click "Yes".
    • If you get a further User Account Control warning, click "OK".
  3. Leave all the components selected unless you are an experienced user and know what you can deselect.
  4. Put the XAMPP folder directly in the root of a hard drive or USB flash drive (e.g. "C:\xampp\" or "D:\xampp\", not "C:\Program Files\xampp\" or similar)(2). The rest of this guide assumes you used "C:\xampp\". If not then substitute your drive's letter where appropriate.
  5. Do not start the XAMPP Control Panel yet! (un-check the box to do so and click "Finish". If you did start it then just quit it.)
  6. Make sure Windows is displaying file extensions. There are many tutorials online explaining how to do that.
  7. Backup c:\xampp\apache\conf\httpd.conf by copying it to c:\xampp\apache\conf\httpd.conf.ORIGINAL or some other name you can remember.
  8. In C:\xampp\apache\conf\httpd.conf change the following lines in a text editor:
    • Change Listen 80 to Listen 127.0.0.1:8080 (Adding 127.0.0.1 ensures that this web server can only be accessed on the computer hosting the web server.)
    • Change ServerName localhost:80 to ServerName localhost:8080
    • Append the following 2 lines to the end of the file if you plan to use Drush, a command-line shell and scripting interface for Drupal (if in doubt, you probably will use it later):
    # for drush and migrate
    SetEnv DRUSH_PHP /xampp/php
  9. Start the XAMPP Control Panel (C:\xampp\xampp-control.exe) and choose your language.
    • If you create a shortcut for xampp-control.exe then right-click on the shortcut & check the "Run as administrator" check-box under "Advanced Properties".
    • If you get a User Account Control prompt, click "Yes".
    • If you get a “Port 8080 (or 80) in use” message from Apache then press Ctrl+Alt+Delete to start Windows Task Manager & end any other Apache tasks that may be running.
    • If you get a “Port 3306 in use” message from MySQL then press Ctrl+Alt+Delete to start Windows Task Manager & end any mysqld.exe process that you find.
  10. Click the "Start" buttons next to both "Apache" and "MySQL" in the XAMPP console.
    • If you get a Windows Security Alerts about Windows Firewall then leave just "Private networks..." checked and click "Allow access" to continue.
    • To make future start-up easier, click "Config" then, under "Autostart of modules", check "Apache" and "MySQL".
  11. Test your XAMPP installation by opening a web browser and entering http://localhost:8080/ in the address field. The XAMPP welcome page should appear.
  12. Type http://localhost:8080/phpmyadmin/ in the address field or click "phpMyAdmin" at the top right of the page.
    • If you get “Error; MySQL said: Cannot connect: invalid settings. Connection for controluser as defined in your configuration failed.” then stop MySql in the XAMPP Control Panel, press Ctrl+Alt+Delete to start Windows Task Manager and look for a MySql process and end it. Then restart MySql in the XAMPP Control Panel.
  13. Click on "Databases".
    • If you wish to use XAMPP to work with an existing local or remote Drupal site you must first create an empty database then use phpMyAdmin to import the database dump.
  14. Below "Create Database" type the name you wish to use for your Drupal database (e.g. "drupal8" or "drupal7"). Don't use "-" or "_" or spaces in the name and use only lowercase letters or numbers. Remember it! Click "Create".
  15. Click "Server: 127.0.0.1" at the very top, then "User Accounts", then "Edit Privileges" for Username "root" and Hostname "localhost". Click "Change Password", then type a password twice then click "Go" at the bottom right.
  16. Close your phpMyAdmin browser page.
  17. Stop both "Apache" and "MySQL" in the XAMPP Control Panel by clicking the "Stop" button next to both.
  18. In C:\xampp\phpMyAdmin\config.inc.php, set the following 2 lines to the username "root" (if not already) & the password you used above:
    • $cfg['Servers'][$i]['user'] = 'root';
    • $cfg['Servers'][$i]['password'] = 'YourPassword';
  19. Download the Drupal .zip or .tar.gz file from https://www.drupal.org/download and extract the drupal-X.X.X folder from within it.
  20. Move that folder inside C:\xampp\htdocs\ and rename it to something like "drupal8", so that you have a folder structure like this: C:\xampp\htdocs\drupal8\core\... etc..

Step 2: Change some values for the development system (1)

The most common sources of installation errors are lack of available PHP memory and/or low maximum PHP execution time. I recommend only for a development system the following values instead of the default values. Do not use these values on a live web server!

  1. Backup C:\xampp\php\php.ini by copying it to C:\xampp\php\php.ini.ORIGINAL or some other name you can remember.
  2. Change the following lines in C:\ampp\php\php.ini:
    • max_execution_time = 600
    • max_input_time = 600
    • memory_limit = 512M
    • post_max_size = 64M
    • upload_max_filesize = 64M
    • mysql.connect_timeout = 600

    For Drupal 8, uncomment this line in the same file by removing the ; in the first column:

    • extension=php_fileinfo.dll
  3. Backup C:\xampp\mysql\bin\my.ini by copying it to C:\xampp\mysql\bin\my.ini.ORIGINAL or some other name you can remember.
  4. Change the following lines in C:\xampp\mysql\bin\my.ini:
    • max_allowed_packet = 64M
    • innodb_flush_log_at_trx_commit = 2

Step 3: Install Drupal

  1. Now restart both "Apache" and "MySQL" in the XAMPP Control Panel by clicking the "Start" button next to both.
  2. To start configuring Drupal, run the installation script by entering http://localhost:8080/drupal8 into your browser address field (where "drupal8" is the name of the folder that you just created and copied/downloaded into).
  3. Proceed to the appropriate guide for your version of Drupal:

    Drupal 8:

    Drupal 7:

Good luck!

Notes:

1) XAMPP should be used only as a development server (look at the first section of https://www.apachefriends.org/about.html for details, or in German at FOCUS berichtet: XAMPP ist schuld am Hack der Bundespolizei)!

2) If you have put the xampp folder directly in the root of a drive, you can copy it to the root of another drive, or connect a removable drive to another computer. If there the ports 8080 (or 80, if you didn't change it), 443 and 3306 are not used, you can start XAMPP without any problems and without any local configuration (e.g. on your laptop or from a USB drive, or on a client's Windows computer) but only if you have never have run C:\xampp\setup_xampp.bat.