Windows 10 graphic: light streaming through a window.

This blog post is a Cookbook that shows how you can install XAMPP on Windows 10 to use it for Backdrop as a development system.  (These instructions also apply to Drupal 7 & 8.)

Remarks

  • The intention of this cookbook is to explain the installation of XAMPP as a development system for Backdrop CMS and 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!

Install XAMPP as a development system

  1. Download XAMPP from Apache Friends.
  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).

Note: If you create a shortcut for xampp-control.exe then right-click on the shortcut and click the Run as administrator checkbox 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".
  2. You may get a Windows Firewall Security Alert. Click Allow access to continue.
  3. Test your XAMPP installation by opening a web browser and enter http://localhost:8080/ in the address field.
  4. The XAMPP page should now appear.
  5. Type http://localhost:8080/phpmyadmin/ in the address field or click phpMyAdmin at the top of the page.
  6. 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.
  7. Also, check C:\xampp\phpMyAdmin\config.inc.php. Make sure $cfg['Servers'][$i]['password'] = ''; contains the correct password. Change if necessary then stop & start MySql.
  8. Click on Databases.
  9. Below "Create Database" type the name of your database, choose something that you will remember during the installation e.g. "backdropcms" (don't use "-" or "_" or space in the name and only lowercase or numbers), and click "Create".

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. Restart "MySQL" in the XAMPP Control Panel by clicking the Stop button next to "MySQL" and then click the Start button again.
  2. Add a .htaccess file to C:\xampp\htdocs. Place the following inside it. This enables Backdrop to find URLs generated by CKEditor when using the inline image embed button. ("backdropcms" in the last line is the folder name you choose to contain your Backdrop file structure. )
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^/?$ index.php [L]
RewriteRule index.html?$ index.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ backdropcms/$1 [L]

Create a folder such as backdropcms inside C:\xampp\htdocs and copy or download your Backdrop 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. 

To start your site type http://localhost:8080/backdropcms into your browser where backdropcms is the name of the folder that you just created and copied/downloaded into.

Change some values for the development system

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
    • File \xampp\mysql\bin\my.ini :
    • max_allowed_packet = 64M
    • innodb_flush_log_at_trx_commit = 2
       
  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.

If you get error messages about Port 80 click Ctrl-Alt-Delete and end any Apache processes.

If you get “PHP OPcode caching disabled” while running install.php in Backdrop add zend_extension=php_opcache.dll to C:\xampp\php\php.ini just after the engine=On line.

 

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.

2) Put the XAMPP folder directly in the root of a hard disk or a USB flash drive or a 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\, otherwise read your drive letter instead of C:.

3) 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", a USB hard drive (or an USB flash drive), you can connect this drive to any windows computer to use XAMPP.

If 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 client’s Windows computer, but only if you never have run C:\xampp\setup_xampp.bat!

4) 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.

This is adapted from https://www.drupal.org/node/2347717#note5 by Sam Stamport