Installing Drupal with XAMP on Windows 

Quick install Drupal with XAMPP on Windows 

Last updated on  

18 December 2016  

This Cookbook 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 it for Drupal as a development system. 

Remarks 

  • The intention of this cookbook is to explain the installation of XAMPP as a development system for Drupal. 
  • Important Safety Notice: 
    The instructions on this page should not be used on web servers that can be accessed from the Internet! 
    The safe operation of the web server is not guaranteed with XAMPP! 

Cookbook: 

Follow it step by step

Step 1: Install XAMPP as a development system1) 

  1. Download XAMPP from Apache Friends. Choose the download with the version of PHP that you need. 
  2. Click on the downloaded file to install. Do not start the Control Panel. 
  3. In c:\xampp\apache\conf\httpd.conf change the following lines and then restart the XAMPP console. 
  • Listen 80 to Listen 8080 
  • ServerName localhost:80 to ServerName localhost:8080 
  • Reboot your computer & start the XAMPP Console (C:\xampp\xampp-control.exe). 
  • Notes: If you create a short cut for xampp-control.exe then right-click on the shortcut and click the Run as administrator check box under Advanced Properties it will be easier to start. 
  • If you get a “Port 80 in use” message from Apache start Windows Task Manager & end other Apache tasks that may be running. 
  • If you get a “Port 3306 in use” message from mysql start Windows Task Manager & end any mysqld.exe process that you find. 
  1. Click the “Start” buttons next to both “Apache” and “MySQL” in the XAMPP console. 
  • You may get a Windows Firewall Security Alert. Click Allow access to continue. 
  1. Test your XAMPP installation by opening a web browser and enter  http://localhost:8080/ in the address field. 
  2. The XAMPP page should now appear. 
  3. Type http://localhost:8080/phpmyadmin/ in the address field or click phpMyAdmin at the top of the page. 
  • If you get “Error; MySQL said:Cannot connect: invalid settings. Connection for controluser as defined in your configuration failed.” 
  • Stop MySql in the XAMPP Command Window then press Ctrl-Alt-Delete and look for a MySql process and end it. Start MySql in the XAMPP Command Window and try again. 
  • Check C:\xampp\phpMyAdmin\config.inc.php. Make sure $cfg[‘Servers’][$i][‘password’] = ”; contains the correct password. Change if necessary then stop & start MySql. 
  1. Click on “Database“. 
  2. Below “Create Database” type the name of your Drupal database. Choose a name that you will remember during the installation of Drupal, e.g. “drupal7” (or “drupal8”; don’t use “-” or “_” or space in the name and only lowercase or numbers), and click “Create“. 
  3. Click Server: 127.0.0.1 then User Accounts, then Edit Privileges for username root and hostname localhost: Click Change Password, then type your password. 
  • Make sure that 
  • $cfg[‘Servers’][$i][‘user’] = ‘’; 
  • $cfg[‘Servers’][$i][‘password’] = ”; 
  • Are set to the username & password you used above in C:\xampp\phpMyAdmin\config.inc.php. 
  1. Behind “Create New Database” type the name of your drupal database, that you will remember during the installation of Drupal, e.g. “drupal7” (or “drupal8”; don’t use “-” or “_” or space in the name and only lowercase or numbers), and click “Create“. 
  2. Once you read the message “The database … was created.” close “phpMyAdmin“. 
  3. Please create a password for MySQL for the user “root”, that you will remember during the installation of Drupal: 
  4. Restart “MySQL” in the XAMPP Control Panel by clicking the “Stop” button next to “MySQL” and then click the “Start” button again. 
  5. Create a folder such as Drupal8 inside C:\xampp\htdocs. 
  6. Copy or download your Drupal files there. Note: If this is an existing local or remote site you must first create an empty database then use phpMyAdmin to import the database dump. Be careful that 
  7. To start your site type http://localhost:8080/drupal8 into your browser where drupal8 is the name of the folder that you just created and copied/downloaded into. 

Step 2: Change some values for the development system1) 

Important Safety Notice: 
The following settings apply only to a development system

For a live web server, that can be accessed from the internet, other settings must be chosen, so that it can be operated safely

The most common sources of installation errors are lack of available PHP memory and/or low maximum PHP execution time. 

  1. I recommend for the development system the following values instead of the default values (change them!): 
    • File \xampp\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 
     If you run Drupal 8: extension=php_fileinfo.dll (without “;” in the first column) 
    • File \xampp\mysql\bin\my.ini : 
    max_allowed_packet = 64M 
    innodb_flush_log_at_trx_commit = 2 
     
    • File \xampp\apache\conf\httpd.conf : 5) 
    Listen 127.0.0.1:80 # for drush and migrate: SetEnv DRUSH_PHP /xampp/php 
       
  2. Now restart both “Apache” and “MySQL” using the XAMPP Control Panel (“C:\xampp\xampp-control.exe“) by clicking the “Stop” button next to both “Apache” and “MySQL” and then click the two “Start” buttons again. 

Step 3: Install Drupal 

Install Drupal as told, e.g. in the Installation Guide or Using an installation profile or Cookbook: Build a non-English D7 website

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)! 

3) = Put the XAMPP folder directly in the root of a hard disk or an USB flash drive or an USB hard drive (as “\xampp\” and NOT as “C:\Program Files\xampp\” or similar)! 

I assume for the paths in this cookbook, that we are installing XAMPP on the first drive as “C:\xampp\“, elsewise read your drive letter instead of “C:“. 

4) = If you have put the XAMPP folder directly in the root of 

  • a hard drive, later you can copy this folder XAMPP to every root folder of every windows computer hard drive, if the folder name stays “XAMPP”, 
  • an USB hard drive (or an USB flash drive), you can connect this drive to any windows computer to use XAMPP. 

If there the ports 80, 443 and 3306 are not used, you can start XAMPP without any problems and without any local configuration, e.g. at your laptop or from your USB drive e.g. at your clients windows computer, but only if you never have run C:\xampp\setup_xampp.bat! 

5) = Hints: 

The line “Listen 127.0.0.1:80” instead of “Listen 80” secures, that this webserver can only be accessed on that computer, where the web webserver runs. 

The new line “SetEnv DRUSH_PHP /xampp/php” is only needed, if you use Drush.