I Made Fire! Or How I Fixed Pat’s WordPress Installation

404 error page as an exampleAs I’ve mentioned a few hundred times, I use blogging software called WordPress to create podfeet.com. I’m definitely not an expert but after 9 years of using it I can pretty much muddle my way through. The good news is that both Bart and my buddy Niraj are experts in WordPress and the underlying technologies, so when things get too dicey, they’ll usually hold my hand.

Technology is something that we all pass along to people who know less than we do. I always say that no matter how much you know, there’s someone who knows more, and no matter how little you know, there’s someone who knows less. The only thing I worry about is that each time the information is replicated it gets a little messed up, like too many photo copies! Doesn’t stop me from passing it along though.

So I’ve got Bart and Niraj knowing more than me and helping me, and then I got to help my good friend Pat learn the basics of WordPress. She’s brilliant and knows soooo much I don’t know about other Mac things, and she often helps me so it was fun to be able to help her get started. She came over to the house and we had a nice geek play date.

And then I left her on her own to mess around with themes and plugins and such. I presumed all was well, but this week I got an email from her that read:

A Tale of Woe (or Pat did something stupid…)

I was going along great – decided to try/buy a new plugin called Essential Grid – love it! Installed it, watched a few videos, made some tweaks, hit a couple road blocks. I was poking around my WP settings to see why if I hit ‘new post’ it wasn’t posting in the Grid … it wasn’t even posting in The Blog page … then I saw something shiny! I remembered I wanted to change my site from ‘yourmacdoctor.com’ to ‘patdenglerconsulting.com’. There was a setting for that … so I did it. Now I can’t get to my site. It’s gone. Poof.

Long story…now I’m going for a walk hoping you might take pity on me, even tap me on the head, and say something like “Oh! all you have to do is …”

We jumped onto Skype to do a screenshare so I could try to figure out what she did. Let me step back for a minute and give the basics again on how WordPress works. I’ve described this before, but I think it’s good to review.

WordPress sits on top of four technologies. You need an operating system, a web server, a programming language and a database. It is very common to build this on a set of open source technologies: the OS is Linux, the web server is Apache, the programming language is PHP and the database is MySQL. Linux, Apache, PHP and MySQL together are called the LAMP stack. WordPress takes things you write, like blog posts and puts them into the database, in this case MySQL. Any settings you change in the WordPress interface are also stored in MySQL. This will become important to the story.

WordPress window showing where Pat mucked up her ulrsPat was using the WordPress interface to mess around with her website and found two places where she could change her URL. She explained that in the long run she wants to move to a new website name and as she said, there was something shiny so she typed in the URL she wanted to see. Imagine the address of your house is 123 Main Street. But you’ve always wanted an elegant address like 456 Beverly Blvd. If you started telling everyone that was your address, they’d find nothing when they got there. That’s what Pat did to herself, she simply changed the address but there’s nothing at that address. I should mention that she had changed two URL’s – the first one is called the Home setting, which is the address people type into their browser, and the second was the Site URL, which is where her core WordPress files reside. By changing both of these, it made life more complicated. For example, if she’d just wrecked her home URL her site would have disappeared, but we still would have been able to get into WordPress and just change it back. Because she changed her WordPress files location, we were in a bit of a mess.

However, I knew we weren’t in a truly catastrophic state, because her web server still had all of her files, and we’d still be able to go poke around in them because they didn’t actually move, only WordPress thought they did. We could use an FTP client to connect to the server to fix things. FTP stands for File Transfer Protocol and it’s basically a way of pushing files up to a server on a network and pulling them back down. I knew that structure was undamaged, we just had to figure out how to get back into WordPress.

One of the great reasons to use an open source and widely used tool like WordPress is that there are a gazillion people out there writing for it and helping each other get things fixed when you break them. I did a bit of Googling and I found instructions over at wordpress.org on how to fix the url’s if you muck it up. Evidently Pat was not alone in not being able to resist the temptation to play with these settings.

The good news is that the instructions gave four ways to fix the problem. I’ll go through each of the solutions:

They suggested editing the functions.php file. This is a file that lives inside your theme. Let me back up a minute to explain that your theme file gets called by WordPress to produce the look and feel of your site. It tells WordPress to make your font a certain size, to have a two column layout, change the color of your links and everything else visual. The theme file has no actual content in it, you can swap out a theme file at the push of a button and the site will dramatically change but all of the content will be the same. The instructions said to edit the theme’s functions.php file by entering two lines (one for each type of URL she changed) with the term “update_option” and the type of URL to change and the correct URL. All in the PHP programming language syntax. Remember PHP? That’s the P in LAMP. Pat followed these instructions to the letter…and still her site was down.

Ok, let’s try another solution. They also suggested editing a file called wp-config.php. This file contains information about where your database is, the database name and the database user. You create it during the very first steps of installing WordPress and you pretty much leave it alone after that.

Much like the change suggested in the first solution, we were instructed to add two lines with that started with “define”, followed by the URL type and the correct URL. And…that didn’t didn’t fix the problem either. I don’t know why.

phpmyadmin window showing the tableThe third solution was terrifying to me. They suggested we go into the MySQL database and find the place where she’d changed the URLs and put it back to the original values. Remember I said early on that MySQL as the database simply stores all of the data you enter, like any settings in WordPress. So that imaginary URL Pat typed in was in the database somewhere.

To get into MySQL, that meant entering the dreaded land of phpMyAdmin. This is a web-based interface to the database that I’ve been in many many times. But EVERY time I’ve been in there, someone was holding my hand, and I was gripping it VERY tightly. Niraj dragged me into phpMyAdmin and was a very patient teacher, but I was always terrified I’d bork something up. Bart would also try to calm my nerves, and try to teach me, but it’s pretty scary in there.

So here I am, standing on the brink of this adventure, hearing in my head the words, “winter is coming” but I step forward anyway. Heck, it’s Pat’s website, not mine, right? In all seriousness, this was an experimental version at this point, but she had put a lot of work into it, and she did have a very recent backup so the risk was smaller than I’m making it sound.

Luckily again the instructions were very well written and we were able to follow them quite easily actually. You launch phpMyAdmin from the control panel of your web hosting company, and right there you can see your own database and open it up. Down the left side of the screen is a list of all of the tables in the database. They told us to look for one called wp_options and then to click on browse. Well that makes sense so far. Next they said to look for a record called siteurl. Sure enough, there it was, with Pat’s imaginary url in right next to it. We hit the pencil to edit that record, and changed the url back to the real one. From there we repeated the steps to find the home field and put its url back as well. We clicked Go to save and I was 100% confident that this would work.

And it didn’t. Awe, c’mon! How could that NOT work??? We changed it in the database for cryin’ out loud! I looked at the fourth solution but ran away quickly because it was talking about how to relocate an entire WordPress installation as a way to trick WordPress into finding it’s way back home. I didn’t even understand the beginning of the instructions on that one.

Sadly, while I thought I could do this, I had to call Niraj. Luckily he took my call, and had just enough time to tell me how to search for the errant URL term in the database to see if it was hiding in yet another field, but then he had to run off to work. We did the search but the database was clean.

I was dejected and told Pat that I’d run out of ideas, and that she’d probably have to call her hosting company (who probably could have fixed this by then anyway). But I just didn’t want to give up. I noodled it for a long time, and finally had an epiphany. What if the fact that I actually solved the problem three different ways was making things step on each other? I had Pat go back into functions.php and erase the two lines we’d entered, and also back into config.php and get rid of those two lines … and it WORKED!!!

I have to tell you, I felt like Tom Hanks when he made fire in the movie Castaway. It was a wonderful feeling. I started dancing in my chair singing, “I am your hero!” to Pat. She was as happy as I was so she had to put up with my singing. I feel like the training wheels have been taken off, that maybe I can occasionally go into my databases (after making sure I have a good backup) and fix things. I am very proud of my little self.

2 thoughts on “I Made Fire! Or How I Fixed Pat’s WordPress Installation

  1. Kevin - July 17, 2014

    Hmmm! Another reason I use Blogger with my own domain name!

    Kevin
    Puzzlemad

Leave a Reply

Your email address will not be published.

Scroll to top