Categories
Apache blog Microsoft PortableApps.com Windows WordPress

Installing WordPress to XAMPP on a portable drive

A long time ago I wish I could to do exactly what I’m about to show you how to do, that is have a portable web server that I can plug into almost any computer. This is a useful way to develop for a client & never let it be seen on the Internet until you have finished the job.

Before I list the space needed as this may be an issue if you try to do this on just any portable drive. For some reason Hard drive manufactures think that a megabyte is 1,000,000 bytes when in reality it is 1,048,576 bytes or 1,024 bytes times 1,024 bytes. Also if you are using a flash-based portable drive it only has a limited number of writes for any particular sector, so with use the amount of available space will go down. (I’m not going to get into the details of that in this post as that is another discussion altogether.) So all the space that I’m saying you will need you will need the manufacturer to say that you have IIRC about 7% to 11% more than what they say. (Sorry I didn’t feel like doing that math again.)

One other note with most if not all flash-based drives you can not read at the same time that you are writing so during the copying process you get to wait before you can do much else. Also because the drive I’m using in this is really old you should get faster speeds than I did.

Also I reference “G:\” through out this walk-through you should substitute that with whatever drive letter your drive is assigned.

The following numbers to not account for wasted disk space they only account for total bytes that are used ignoring the wasted space.

  • 1.2 MB PortableApps.com Platform Only (Size on disk is 1.26 MB)
  • 150 MB PortableApps.com Suite Light (Size on disk is unknown)
  • 355 MB PortableApps.com Suite Standard (Size on disk is unknown)
  • 221 MB XAMPP (Size on disk is 241 MB)
  • 116 MB XAMPP Lite (Size on disk is 160 MB)
  • 1 MB XAMPP Launcher (Size on disk is 183 KB)
  • 7 MB WordPress files (Size on disk is 7.04 MB)
  1. 230.2 MB for XAMPP, Platform Only & WordPress files
  2. 379 MB for XAMPP, Suite Light & WordPress files
  3. 584 MB for XAMPP, Suite Standard & WordPress files
  4. 125.2 MB for XAMPP Lite, Platform Only & WordPress files
  5. 274 MB for XAMPP Lite, Suite Light & WordPress files
  6. 479 MB for XAMPP Lite, Suite Standard & WordPress files

So according to these number a 256 MB drive might barely be able to do this with XAMPP & Platform Only, but since it ignores wasted space I guess you could try XAMPP Lite instead.

Here are the files you will need to download. (These links all point to the current version at the time I write this post & the size requirements may change.)

  1. Download PortableApps.com Platform Only, download PortableApps.com Suite Light, or download PortableApps.com Suite Standard (You would go here to check for newer versions.)
  2. Download XAMPP or download XAMPP Lite (You would go here to check for newer versions.)
  3. Download XAMPP Launcher (You would go here to check for newer versions.)
  4. Download WordPress (That link always gets the current stable version of WordPress.)

After you have downloaded all of the files to your computer you will start installing them to a portable drive that can fit all the stuff you just downloaded. Well I just discovered I have a 256 MB flash-based drive so I will try the install on it. I got it almost 10 years ago so it will have some use on it as well. After retrieving the data on it & formatting it I have 246 MB available formatted FAT32. Because I’m installing using FAT32 I don’t have to deal with any security issues I might have if it was formatted NTFS, besides Windows XP won’t let me format it NTFS.

For step 2 You will need a lot of patience as it will take some time to finish installing. Also as far as time goes it does partly depend on the speed of the drive you are copying to my 256 MB drive was old & as such it is slower than a newer drive which would be much faster.

  1. Install the PortableApps.com platform or suite that you chose to download. If you don’t have a previous version installed & have it running you will need to tell it which drive to install it on, you will need to remember this for the next step. Aside from that Windows asks if you really want to run it which is a yes, than it asks which language, since I speak English I went with that, You hit next so it will ask you the drive letter, in my case it was “G:\” (They do have a browse button.), than you click on install, than leave the box checked to “Launch PortableApps.com Platform”. A new icon will show up in your system tray, which is down by the time.
  2. Install XAMPP & specify the drive letter you noted in the last step. (Remember you drive letter may be different then it is on mine so don’t go with “G:\” unless yours was assigned to that letter also.) It will also ask you if you want to run it so you click on run, then it asks the installation folder which on my computer it defaulted to “C:\” which is wrong so I changed it to “G:\” & clicked on install (It has a browse button as well.), I then waited for over 3 hours. After the wait it brought up a DOS window asking “Should I add shortcuts to the startmenu/desktop?” so I said no, then for the “Should I locate the XAMPP paths correctly?”, so I said yes, then for “Should I make a portable XAMPP without drive letters?” so I said yes (this takes a while as well I didn’t time it though, but I think it took less than 20 minutes.), it then lets you know which time zone it thinks it is in, & provides information on what file to modify to correct that if it is wrong. After that all you need to do is tell it to exit with an x & then an enter.
  3. Install XAMPP Launcher If you have the PortableApps.com platform or suite running it should detect which drive to install on to. So if you have the portable app running all you need to do is click on next, than install, than finish. To see it in the list you will want to go to the portable apps icon in the tray, Options, Refresh App Icons. After installing all of that I noticed I was out of room so I can’t even fit WordPress on it. (It turns out that a full copy of XAMPP takes up 241 MB due to wasted space.) Also before I started this I thought that the Lite version didn’t have MySQL but had SQLite instead, turns out I was wrong so I guess I’ll try that instead.
  4. Install WordPress. You need to launch the XAMPP Control Panel so that you can start MySQL & Apache. You also need to copy the extracted files & folders for WordPress into “G:\xampplite\htdocs” I just copied the wordpress folder so that it will be here once it is installed. So browse to here to create a new database. You need to name it, create a user name for it & a password for the user name. So under “Create new database” you enter the name you want to assign it, I just called mine wordpress, then you just click on the create button. Since it will automatically take you to that table you just need to go to the “Privileges” tab & click on “Add a new User”, set “User name” to the user name, set “Host” to local in the drop down, Hit the Generate button next to “Generate Password” to assign a random password to the database with the third field showing you it in clear text, you will want to either copy it watching case or copy it to the clipboard. Then under that make sure that “Grant all privileges on database” is selected, next to “Global privileges” you want to click on “Check All”, then you just have to click on the “Go” button. Now you want to go here to start the install, click on the “Let’s go!” button, set the MySQL, database name, user name, & password. You can leave the database host with the default of localhost also if you want you can change the “Table Prefix”, I never install more than one install to the same database as I don’t want to ever deal with that. Then hit the “Submit” button, than if you got the details right you can click on the “Run the install” button, it than asks for a “Blog Title” & “Your E-mail”, on my personal blog that I posted this my “Blog Title” is “Joker”, the “Your E-mail” is the e-mail address that the admin account will be assigned, If you leave the “Allow my blog to appear in search engines like Google and Technorati.” option checked when you click on “Install WordPress” you can just export from the USB install & than import it on to your web host. After waiting for a time assuming you have your php.ini set to allow it to run long enough you will be told that the user name is admin & what the randomly generated password is.
  5. If you want to follow good protocol you will go here to get a custom set of constants which are used since version 2.6.0 of WordPress. You then add it to the wp-config.php file in about lines 45 through 48. This isn’t as important on a portable install but it is still a good idea

When I installed XAMPP Lite it only took about 2 hours to install, it asked the same questions that was asked for the regular XAMPP install. I didn’t time how long it took to make the change for XAMPP Lite so that it doesn’t use any drive letters.

I also learned something else during this install. If your drive is slow enough you will have timeout issues after you enter the “Blog Title” & “Your E-mail”. I got this after I changed the max_execution_time to a ridiculously high 999999. The php.ini file is located in “G:\xampplite\php”.

The final total for XAMPP Lite, Platform Only & WordPress installed uses 167 MB. I’m not testing how much space is ultimately used with any other combination as that takes way to long to do.