Sunday, November 16, 2008

Portable Xampp

Running LAMP on a USB stick

Last year we decided to stop using IT services and teach programming by having students run LAMP from a usb stick using server2go. It was successful enough (despite some new technology problems) that we want use the same approach again. With larger and faster usb drives like the excellent Corsair Flash Voyager GT series this is now a useful option.

We had downloaded and installed the XAMPP stack on our linux laptop and were quite impressed by the excellent job done by the project team. The next step was to try running it on a usb stick using the portable apps project.

The portable apps web page has an installable XAMPP control panel which we added to our stick and then:

  1. Double click StartPortableApps.exe
  2. Click the portable apps icon on the taskbar
  3. Scroll down and click on Xampp control panel
  4. Place tickmarks in the Apache and mySQL services
  5. Click the start button for each service to start them
  6. Goto http://127.0.0.1/ Which laods the xampp/index.php (be sure to allow 127.0.0.1)
  7. The status menu item will let you know what is running.
On my first attempt mysql was not running so none of the demos worked.

The problem was that i had been running wampserver off the desktop the usb was plugged into. Although i had shutdown wampserver the apache webserver was still running which prevented xampp from operating correctly.

The solution was to go to control panel, administration, services and to change the wampapache service properties to manual and to shut down the service.

I then re-ran the xampp control panel from the portable apps menu and when we clicked on the status menu item we see mysql is running correctly on port 3306 and apache is running on port 80.

We try out the demo apps and they all work. The next task is to port some of my examples from the server to the usb stick. This involves:

- exporting the mysql database into a backup .sql file
- creating the users on the mysql usb database
- restoring the database from the backup.sql file
- copying the .php .css .htm and .jpg files from the application's folder to the usb stick

No comments: