It’s summertime and in the South, that means it’s getting HOT! Newman, (a brand new home owner, btw – who knew turning 40 meant growing up?) is two weeks into his experiment to see how long he can stay on an inner tube only working from a solar charged, first generation, “ruggedized” iPad.
It’s a good thing those inner tubes have a hole in the bottom. That’s all I’m saying.
Back here at BUX HQ I’m working on a project where because of some SSL shenanigans and moving from one host to another, I need to work on a local copy of a website that I’m in the final stages of preparing to launch. And since I work on a Mac, that means launching MAMP.
And it dawned on me: I should have done this a long time ago.
Now, to everybody who is reading this who is in high school and college, let’s get this out of the way…
Yes, you’re right, and I’m glad you’ve already been doing it that way for years. You’re still perfect, adults are stupid and you won’t know what that feels like until you hit your mid-20s. So enjoy the superiority complex while you still can.
To the rest of us, this makes sense if you think about it.
There are only two cases where you’d develop right in the final hosting space:
1. For a new website
2. For those of you who know how to do so and can redirect the home page to another page with the .htaccess file
But basically, at some point you’re going to have to move your site install from one place to another. And since that’s the case, you might as well move it from your local machine to your remote machine rather than from one remote computer to another.
The Way Most of Us Do It
I haven’t taken a formal survey (ironic, no?) but most every web developer I’ve ever known works commando. Well, except for Danny Holyfield. That dude just loves to sandbox a website.
If you’re like me, you edit directly in the WordPress admin. Because fuck Dreamweaver. (And because I haven’t yet bought Coda 2 and haven’t really started using Sublime Text 2 – both things you really should consider.)
We do it because… well, why not? I make back ups. It saves the trouble of working locally, uploading the file the server and having to refresh the page. When we work on the live code, all we have to do is update and refresh – it’s the official two-step dance of developers everywhere.
Plus, lets be honest. It feels kinda good to do it the hard way. Like you’re some kind of elite coder even when you have to Google how to write a proper PHP tag.
And there’s a certain cache that comes from essentially editing in a raw text editor. At least until you run into a real programmer and they show you how the big boys do it.
On the other hand, there are real downsides too:
1. The server could go down
2. You could run into a problem where you can’t access part of your code
3. Somebody else might overwrite your code
And what if you need to give a presentation? You can’t rely on the venue to have Internet. And you probably shouldn’t rely on your phone to be a mobile hotspot. You need the ultimate in redundancy: a local copy.
Plus, it’s just more professional. You can keep and arrange your projects more efficiently and once you get your process down for porting your site to where it’s going to live on the server – you’ll save a heap of time too.
Let’s jump right into it.
The first thing we need to do before we install WordPress is to get server software on our machine.
I working on a Mac, so we’ll be installing MAMP. If you’re on Windows, you can install WAMP. Yes, I think that’s cute too. But since I’m not on a PC, you’ll have to look elsewhere for the WAMP walk-thru.
MAMP stands for:
This describes, in order, the type of computer being used, the server software, the database software, and the programming software. All of this is packaged together in a program called MAMP. The AMP part can be written for Mac or Windows – hence the MAMP or WAMP names.
You can get your copy of MAMP from MAMP’s website.
MAMP is a fremium product. Meaning, there’s a free version – which is what we’re going to use – and a Pro version. The Pro version is $59.00. If you find yourself limited by the free version or just want to support the developers, you can upgrade at any time. The MAMP download includes both the free and Pro versions. The Pro version can be used for 14 days if you’d like to try before you buy.
Considering that you’re installing a freaking web server on your machine, the installation is almost too easy. It’s essentially the same thing you’d do for any other program:
1. Get the latest version of MAMP from their website. I’m on 2.0.5.
2. Open the .zip file and then open the MAMP.pkg.
3. Follow the instructions to go through the install. At one point during the install they’ll ask you for your computer’s admin password. Be sure to have that handy.
4. Launch the MAMP app. You can navigate to the Applications folder in the Finder window or use spotlight, whichever is easier.
5. It’s going to ask you whether you should launch MAMP or MAMP Pro. It will tell you to administer both from the Pro version. I don’t know what’s going to happen after the 14 day free trial is up, but for now, since we’ll need to edit some settings, let’s choose MAMP Pro.
If everything worked correctly, you’ll see two things. The first is a small admin panel and the other is a webpage.
As you can see from the page above, the default username and password are “root” and “root”. This is known as a Bad Thing. I’m not the world’s most security conscious dude but I do feel like changing the default u/p is a good idea. But before we do that, let’s get WordPress installed.
Installing WordPress on Your Local Machine
The first thing you’ll need is a copy of WordPress. As of this writing, they’re up to 3.4. But whatever the version, you can get the latest one here. Download the zip and unzip it.
Now we need to know where to put it. And that seems harder that it should be. But let’s look at it.
Finding the root folder
First, if this were a remote server, you would have FTP’d your way into the domain and then you’d navigate to the right folder and you’d upload your files. But here, we immediately run into a problem. Our URL looks like this:
The “localhost” part of that obviously means your local machine. The “8888″ part refers to a port number. The “MAMP” to a directory and “English” because why the hell not. None of that seems to indicate where we can put files. But let’s think this through. There’s probably a setting for this in the admin panel.
Click on the “Hosts” button and look in the lower right portion of the screen. There you’ll see the directory. You can use that one or change it to whatever you’d like to.
Now, all you have to do is navigate there in your Finder window.
You can verify by adding an HTML or PHP document. If you add a document that has PHP, you’ll verify that it’s working. (What, you don’t trust me?)
Now, copy the files inside the WordPress folder (but not the folder itself) into your htdocs folder. If you want to put them in a sub-directory (for instance, if you want multiple installs on your machine), go right ahead.
Changing the default MySQL password
Remember when I said we’d want to change the username and password earlier? This is the perfect time to do it.
Back in MAMP Pro, click the “Server” button (this is only necessary if you had previously clicked the “Hosts” button from above, otherwise it will already be selected). Then click the “MySQL” button. You’ll see this big button. Click it. You know you want to.
It’ll ask you to enter a new password and to verify that password by entering it one more time. Then MySQL will restart and a previously unavailable button to access phpAdmin will become active. Progress!
All up in yo’ guts, WordPress
Let’s tell WordPress how to hookup with MySQL. This will let us move on from there to going through the WordPress install wizard.
First, change the “wp-config-sample.php” file’s name to “wp-config.php”. Now launch it in your favorite editor. Or TextEdit if you don’t have a favorite editor. All of my screenshots are from Sublime Text 2. A dope free text editor that my programming buddy, Danny, above, turned me onto.
We want to change three values:
We already know the answer to two of these values:
The username is “root” (without the quotes). We know this because the webpage that first launched when we installed MAMP told us.
And the password is whatever you just made the password.
All that remains is to know the name of the database.
Adding a database using phpMyAdmin
In order to know the name of the database, we need to first create one.
Click the “phpMyAdmin” button. If your button is gray, you need to click the start button at the top of the window.
If this is your first time looking at phpMyAdmin DON’T FREAK OUT.
You’re going to want to. You know when nerds stop styling their data that they must be serious. This is deep in the belly of the beast.
Fortunately, what we need to do is really easy.
On the phpMyAdmin home page, you’ll see something that looks like this:
All you have to do is name your database and click “Create”. I named mine “wordpress”. Get funky with the naming at your own peril.
Take those three values: the username, password, and db name and edit the wp-config.php file. Save the file.
Whew! The hard part is over!
Setting up WordPress
Now it’s time to go through the “famous five minute WordPress installation process”. All you have to do is go to “your website”. If you don’t know what that is, just click the “WebStart” button next to the Start/Stop button in the MAMP Pro admin panel and it’ll launch a web browser with the URL that looks like this: http://localhost:8888/MAMP/?language=English. Just get rid of everything after the “8888″ and you’ll be at your front page.
If you put your WordPress files in a sub-folder, remember to include the sub-folder in your URL string.
Now you should see this page.
Fill out the requested information, uncheck the “Allow search engines to index this site” and click the Install button.
If everything works correctly you’ll see this page:
Click the Log In button and get down with your bad self. You just installed MAMP and WordPress. You’re a genius!
Now, don’t you have something better to do? Like check Facebook… or Words With Friends (or Draw My Thing)?