I’m lazy, so when it comes to my personal Web sites, I tend not to do the right thing and set up a dev environment first. Instead, I just deploy stuff and work on the templates directly in my live Web site. I keep copies of the templates locally before I go messing around, so I figure the worst that can happen is the pages on my site will go down briefly if I accidentally put in a syntax error. I can back it out pretty quickly and restore the site, so why bother with a dev or test environment first?
Recently though I wanted to upgrade the software on my OraclePortalSucks.com site to the most recent release. When the upgrade process failed, I realized that I needed to revert the entire site to the original templates and set up a dev environment so I could test out the upgrade and figure out what I did wrong.
I slapped this site together because I was looking for an avenue to vent about yet another weird set of bugs in the Oracle Portal. I was able to get the site online only a few hours after I registered the domain because I already had a hosting plan. I uploaded bbPress, which is a powerful yet easy to manage bulletin board system from some of the same folks who created WordPress. I hadn’t really touched the site since I set it up back in January, and my attempt to upgrade bbPress to the latest version blew up for me.
My first step was to set up a local development environment to support bbPress — this means Apache, MySQL, and PHP. I really like the way XAMPP rolls all those into a single ZIP file and wraps a simple GUI around the whole package to let you start and stop the various components. Plus, it’s great because it doesn’t have to be installed — you can run it immediately after unzipping the whole mess as long as you unzip into the root directory of your hard drive with the \xampp folder. I downloaded the latest version and unzipped it onto the C drive, thus it’s in C:\xampp.
In the xampp directory, you should see a file called xampp-control.exe. Double-click that to launch the administration utility.
I don’t use the options to install and set up the components as services because I don’t use this all the time. I just click Start next to the components I need. In this particular case, you’ll need both Apache and MySql, so start both of those.
Now launch a browser and go to the http://localhost address. You should see the XAMPP Web site.
In the left-hand menu bar, scroll down until you see the Tools section. Click on phpMyAdmin.
From the phpMyAdmin page, click the Privileges link and then click on the Add a New User link. Here I created a database and user to match the configuration used in my existing OraclePortalSucks bbPress setup. You can create whatever name and database you like — just jot it down because you’ll need the info to edit the config.php later. Then scroll to the bottom of the page and click the Go button.
Now I had to get the PHP templates and the database contents from my site. The PHP templates were easy — just FTP them into a local folder. I called the folder “portalsucks” and put it in the C:\xampp\htdocs directory. Then I edited the config.php file in that portalsucks directory. Since I had created a database and useraccount with the same name as in the actual site, I only had to change the host string:
I also changed the domain and path from the original settings:
$bb->domain = 'http://www.oracleportalsucks.com';$bb->path = '/';
to something appropriate for my local configuration:
$bb->domain = 'http://localhost';$bb->path = '/portalsucks/';
The last step was to download the database. My hosting company uses phpMyAdmin as well, so I selected the database and clicked the Export option. I just left all the default values and clicked Go. That generated a textarea that I cut-and-pasted into a local file which I could then import into my local phpMyAdmin.
Since I had already created the database, I did have to edit the SQL to comment out the CREATE DATABASE command; otherwise, phpMyAdmin complains because you’re trying to create a database that already exists.
I now have a fully functional development copy of my site. I just need to roll up my sleeves and figure out why my attempt to upgrade bbPress failed.