XAMPP local testing server

I had a need for a local testing server on my Windows desktop so I was about to install part of the LAMP stack (Apache, MySQL, PHP) when I stumbled upon XAMPP, an all-in-one package offering these (and a lot more too) in a fast install.

Local server up in minutes

I have to say I’m very impressed with XAMPP-lite! Once I’d got round the usual oddities (e.g. file locations based on physical drive locations, such as C:, instead of a proper hierarchy) of running software originally developed for *nix on Windows I had a working test server running locally in no time at all.

Configuring XAMPP for local domain names

Testing a website from localhost file paths instead of DNS worked well but I soon added a hosts file entry and a bit of virtual host configuration magic to avoid problems (e.g. with Apache RewriteRule directives).

I chose to use a fake subdomain of ‘local’ and then mapped that in XAMPP’s vhost.conf equivalent.

hosts file

e.g. notepad %WINDIR%\system32\drivers\etc\hosts

127.0.0.1	local.example.com

virtual hosts file

e.g. notepad %SYSTEMDRIVE%\xamp\apache\conf\extra\httpd-vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
        DocumentRoot /xamp/htdocs/example.com
        ServerName local.example.com
</VirtualHost>

Hats off to Apache Friends for XAMPP.

Commentary