I’m just 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 do 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. And when the upgrade process failed utterly I realized I would need to go ahead and revert the entire site to the original templates, then set up a dev environment somewhere so I could test out the upgrade and figure out what I did wrong.
Now this was a site I slapped together one January afternoon last year, when I was banging my head against yet another weird set of bugs in the Oracle Portal. I got so frustrated I had to find some avenue to vent so I registered the domain, and since I already had a hosting plan I was able to get the site online within a few hours of registering it. I uploaded BBPress, which is a powerful yet easy to manage bulletin board system from some of the same folks who created WordPress. But then I haven’t really touched the site since. It was the attempt to upgrade BBPress to the latest version that blew up for me.
So first step was to set up a local development environment to support BBPress. That 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 un-zipping the whole mess as long as you unzip into the root directory of your hard drive with the \xampp folder. So I downloaded the latest version and unzipped it onto the C drive, thus it’s in C:\xampp.
Inside that 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. Of course 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.
So 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:
define(’BBDB_HOST’, ‘localhost’);
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/’;
Last step was to download the database. Luckily 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 licked Go. That generated a textarea
that I cut-and-pasted into a local file. Which I could then import into my local phpMyAdmin.
Now 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.
That’s it. I now have a fully functional development copy of my site. Now I just have to roll up the sleeves and figure out why my attempt to upgrade BBPress failed.
No comments:
Post a Comment