XAMPP Lite on USB Disk – Benchmark PHP and MySQL by Slowing Down Your Server

Page content

To develop PHP and MySQL on a Windows machine, I usually use WAMP. I had tried XAMPP before, but I found that it was a bit bloated, with the OpenSSL and FTP Server, etc. So WAMP it was. But lately, I decided to give XAMPP another try and I like what I’ve got so far.

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.For the past three weekends, I’ve been away from my personal computer. The only life line I’ve had is my stock of Portable Apps on my 512MB USB disk. So I’ve been neglecting a few projects lately. But all of this has changed as of Friday. I’ve discovered XAMPP Lite. It’s just what it says it is, a Lite version of XAMPP. The beauty of this is that it can also run from a USB disk. There’s no install required. So partnered with XAMPP Lite, Mozilla Firefox, Portable Edition, NotePad++ Portable, and, FileZilla Portable I can take my development on the road to anywhere I can stick in my USB disk.

Added Bonus

I don’t have to tell you that running an Apache web server, PHP 5.0 and MySQL from a USB disk is not a great idea for a production environment. Disk access to the USB disk is much slower than a hard drive. This has an unexpected benefit that I’ve noticed with CakePHP. Queries that used to take 3 milliseconds and 4 milliseconds now take 300 milliseconds and 400 milliseconds.

So why am I excited about stuff running so slowly? When you have a table with 20 fields, but only regularly use five (5), CakePHP makes it so easy write $this->paginate() or $this->findAll(); to retrieve results that we sometimes forget the all 20 fields are being returned every single time. You see the debug say that “3 queries took 10 ms". You don’t really think much of it, but when the debug window says “3 queries took 500 ms”, you realize that you need to do some work. It makes you think about things that normalizing databases, and caching models, controllers, and views.

Installing XAMPP

There’s not really much to it. You download XAMMP Lite, dump it in a folder. That’s the first part. Now the configuration is where you have to be careful. There are two possible configurations:

  1. Root Directory Installation
    • Drop the XAMPPlite folder to the root of the USB Disk.
    • Modify your Apache and PHP configuration files as you normally would.
  2. Sub Directory Installation
    • Drop the XAMPPlite folder in a folder of your choice.
    • Run setup_xampp.bat. This will go through every configuration file and set the path based on the drive letter and installation directory. The problem with this installation is that you’ll have to do this every time you move to a system with a different drive setup (eg. At home my USB is G:, at work it’s F:)
    • Modify your Apache and PHP configuration files as you normally would.

Everything else you do is as normal. Happy developing. At 130 MB you can’t go wrong. At 130 MB a pop, you can’t go wrong.

Source: XAMPP 1.6.3a [Apache Friends]