WordPress WIMP Notes
More notes to myself, on the experience of installing WordPress on Windows Server 2003 Standard, IIS, MySQL, and PHP. Boring boring boring. But, these notes just might save my ass next time I have to do this. Keep in mind I don't really know anything about Windows Server or IIS, so please take with a grain of salt ;-)
Installing PHP & MySQL
These instructions from Ringmaster on the WordPress Codex were a very helpful starting point as far as what packages to download, and the order to install them in. Basically:
Download latest 4.x version of PHP Installer Binary for Windows. Don't download 5.x, since WordPress 1.5 isn't tested with it.
Using the Installer also configures IIS for you automatically for PHP. Yay!
The first time I ran it, I got some script errors related to certain script files not being associated with a script interpreter...something about CSCRIPT and WSCRIPT. I clicked "Accept" on an offer to associate scripts with a particular interpreter, ran the installer again, and it seemed to work properly. Thank goodness.
Download the latest MySQL Installer Binary for Windows. I grabbed 4.1.7.15, which apparently breaks WordPress 1.5 (more specifically, PHP's database connection code), but you can change a setting and it will work. More on that later.
Incidentally, I downloaded the "Essentials" installer package, which is the leanest and meanest MySQL installation you can download. It doesn't come with a GUI-based database adminstration tool, though, which sort of bites...if that's important to you, download the BIG one.
The Installer package does nice things like set up the service to automatically run, so you don't have to worry about it. One less headache!
When you run the Installer, you'll get prompted for a password for the
rootuser. Pick something you won't forget...this is the main database password that you'll need to add users later. Otherwise, you'll be locked out of your database...and wouldn't that be embarassing.You also are prompted for a lot of decisions about how to configure the server. I just accepted the defaults, which are fine for a light webserver. The one thing I changed was the way text was stored; I choose Unicode (UTF-8) just because it might be nice to support Asian characters in the blog. I don't know if this was necessary, but I chose it anyway. Nyah!
The rest of the document was not so helpful about IIS configuration...it's assumed you know how to do it already. I don't, so the following steps detail what I found out.
Copying WordPress Files
I grabbed the WordPress 1.5.2 .ZIP file, unpacked it, and then copied it to C:InetPub, which is sort of the equivalent to htdocs on Apache. I copied my wordpress directory there: C:InetPubWordPress.
Next, you gotta set permissions on C:InetPubWordPress... The wordpress directory needs to have a user called Internet Guest Account added to it. Right-click the folder in the Windows Explorer, choose the SECURITY tab, and then click ADD. Type in the name of the user---on mine, it looks like HOSTNAMEIUSR_HOSTNAME, where HOSTNAME is the name of your computer.
The specific permissions I added: READ&EXECUTE, LIST FOLDER CONTENTS, READ, and WRITE. WRITE appears to be necessary so WordPress can create the default Theme file. I'm not sure if LIST FOLDER CONTENTS is strictly necessary.
Configuring IIS
Next, I used IIS Manager to add a new "Virtual Directory" for the "Default Web Site". This allows you to add "directory names" to your main website root. In a new IIS installation, the website you start off with is actually called Default Web Site; by right-clicking the name in the IIS Manager, you can choose New... then Virtual Directory. In the wizard dialog that follows, give it a name (this is marked "Virtual Directory Alias") and a corresponding location ("Web Site Content Directory") on disk, and choose run scripts to finish up.
So what does that mean? You have just added a subdirectory to your website URL that actually points somewhere else; it's like a symbolic link in unix, or a shortcut in Windows. Say your server's domain name is server.myhost.com; the default location for web files (as defined by Default Web Site) is C:InetPubwwwroot. Now, I could just have stuffed the wordpress directory into there, but I decided to put it at C:InetPubWordPress instead:
server.myhost.compoints toC:InetPubwwwrootserver.myhost.com/wordpresspoints toC:InetPubWordPress
So yeah. while I could have put the WordPress files in a subdirectory in C:InetPubwwwroot, this gives me a tiny bit of extra flexibility (see Footnote 1). Frankly, I'm not sure it was necessary, but I did it.
Now, you need to right-click the resulting icon (the wordpress object you just wizarded-up) and choose PROPERTIES. Click on the DOCUMENTS tab and add index.php to the list of "default content pages".
While you're here, check out the VIRTUAL DIRECTORY tab: you'll see where your wizard-entered values ended up. In typical computer bullshit fashion, they use different names (gah):
- "Virtual Directory Alias" is called "Application Name"
- "Website Content Directory" is called "Local Path"
- The script permissions are under "Execute Permissions"
I think that should do it...if you browse to http://yoursite.com/wordpress, you should see a nice error message about not being able to connect to the database. That means the PHP is working! But we have to set up the database and database connection next.
Troubleshooting: If you get an error that you're not allowed to access the resource, or if you see an authentication dialog, check permissions.
Troubleshooting: It is also possible that your Virtual Directory is set to not allow anonymous connections to your website...you can check that by right-clicking the Virtual Directory (wordpress, under Default Web Site), choosing PROPERTIES, then clicking the DIRECTORY SECURITY tab and clicking EDIT under Authentication and Access Control.
Troubleshooting: If you see "Error 403 Forbidden Execute Access Is Denied", you need to set the "Execute Permissions" on the wordpress Virtual Directory object...it's under the VIRTUAL DIRECTORY tab. Change it from "None" to "Scripts Only", and that should do it.
Creating the Database
At this point, both PHP and MySQL are installed. Before WordPress can start its famous 5-minute install, you need to spend several minutes creating a database and a user for it to use.
Now, I had downloaded the "Essentials" version of MySQL 4.1.7.15, so it didn't come with a nice graphical GUI. It comes with the MySQL Command Line Client, which you could use to do something like the following:
CREATE DATABASE 'wordpress_database';
GRANT ALL ON 'wordpress_database' TO 'user'@'localhost';
SET PASSWORD FOR 'user'@'localhost' = OLD_PASSWORD('user_password');
...which theoretically would work; note the OLD_PASSWORD call: this is a workaround for MySQL 4.1+ changing the way password authentication works, which breaks the version of PHP I was using.
I was actually a lot lazier and downloaded MySQL Administrator instead, which is a GUI interface. Ordinarily I like using the command line, but not for SQL. Typing SQL statements gives me a huge headache, plus the syntax never seems to exactly match the documentation. Like the use of ' characters... sometimes you need them, sometimes you seem to actually have to use " or not at all, or the function names were changed in the particular build you have...Bah!
Anyway, to set the OLD_PASSWORD parameter in MySQL Administrator (v1.0.21 for me), go to STARTUP VARIABLES, select USE OLD PASSWORDS, then stop/restart the server using SERVICE CONTROL. This worked, and MySQL Administrator only crashed on me once! Whee! That's quite an improvement over earlier versions :-)
If you had set the password before setting the USE OLD PASSWORDS value and restarting MySQL , you will need to set the password again. After that, you're finally ready for the WordPress 5-minute install.
For completeness, Footnote 2 (on the second page) covers the basics of what I did to use MySQL Adminstrator.
WordPress 5-Minute Install
It's the one you know and love: edit wp-config.php, then navigate to the Install URL. For the database name, database user, and database password, use the values you used in the previous step. The database host is localhost. MySQL Administrator is useful for verifying and testing the values before you peck 'em into the config file.
Troubleshooting: if you are getting an error about not being able to establish the database connection, and you're absolutely sure you have the correct database name, etc...it might be that OLD_PASSWORD thingy. That's what happened to me. Grr.
Troubleshooting: If you get a permission denied error writing a file in Step 2, it might be related to not having WRITE permissions set for the IUSR_HOSTNAME user on C:InetPubWordPress. I got that error, and set write permissions, and it seemed to work.
Wrapping Up
It seems to be working. I haven't tried any plugins yet, or any of the mail-based features, so we'll see...
Footnotes
I actually have a slightly different configuration that what I'm describing here, because I'm forwarding HTTP traffic through my firewall/router to the windows server. I have a CNAME entry that maps to the associated DNS entry for my cable-modem connection (which changes very rarely), so I'm using another feature of IIS called "Host Header Values" to host multiple websites on the same IP address. It's roughly equivalent to Apache's Virtual Host configuration.
Because I'm using a different Virtual Host, I'm also using Virtual Directories. The only advantages I can really see between that and using a "real subdirectory" for my WordPress install is that you can put the folder somewhere else. I did that so my wordpress files didn't have to be buried in the
wwwrootfolder, which makes them a little easier to find and back-up, and you could theoretically locate them on another shared drive over the network. So it's really just a file-system organization choice; if you compare the properties for a regular subdirectory (right-click one) versus a Virtual Directory, the only thing that's different is really the active "Application Name" field. Applications are some kind of ASP/IIS concept that I don't quite understand, so this might be more important than I realize.To use MySQL Administrator, you need to connect to a database server (here called the "MySQL Server Instance") with a username and a password. A dialog pops up for me that has the fields Server Host, User Name and Password. Use
localhost,root, and the password you picked---I hope you wrote it down---when you first installed the MySQL binaries. Leave the Port value alone.You'll get a big dialog window with a list of items on the left. To create the wordpress database, click the CATALOGS item. You'll see a list of "Schemata" appear, with
mysqlandtestalready listed. These are the databases that MySQL already has installed. Leave them alone, but right-click one of the items (sigh...this hurts the UI designer in me) and choose CREATE NEW SCHEMA. This will be the database that WordPress will need to know about when you fill in thewp-config.phpfile. I called minewordpress01, since I thought I might create multiple wordpress databases in the future.Next, you'll have to create a database user that can access just the new database. So click USER ADMINISTRATION, and you'll see a list of "User Accounts" appear. The "root" user is already in the system, but that user has access to EVERYTHING. We're going to make a less privileged user, with access only to the
wordpress01database.Right-click the "root" user and choose ADD NEW USER. I know, it makes no sense to click an existing user to add new user, but trust me. You'll have a new user literally named
New User, and you can fill out the big pane on the right.Now, fill out the MySQL User and Password fields. Write this stuff down, because you'll be plugging this also into
wp-config.phplater. Click the APPLY CHANGES button, and you'll see the User Accounts field update.Almost done! Now right click the user you just created, and choose ADD HOST FROM WHICH THE USER CAN CONNECT. In the dialog box that appears, enter
localhost. You'll see this appear below your new user's name. Now, left-clicklocalhost, and in the window on the right click the SCHEMA PRIVILEGES tab. In the left-most subwindow ("Schemata"), click thewordpress01database. Then, in the right-most subwindow ("Available Privileges"), click the<<symbol to assign all privileges to your new user. APPLY CHANGES, and close MySQL Adminstrator. BTW, make sure you did left-clicklocalhostand not the username; otherwise, you assign privs to a user that can connect from anywhere over the accessible network.If everything has gone to plan, you have created a new database called
wordpress01, created a user that can connect to the MySQL database server fromlocalhost. That's enough, because in this example the web server and the database server are on the same machine.In retrospect, this was somewhat easier than installing MySQL / PHP on my Linux box with Apache, what with all the extra library dependencies I had to resolve. And configuring Apache really sucks...I would hate to do that again. Though, it might not have been so bad if I didn't use a text-based distro (Slackware, on a Pentium 166) and installed everything from source. And, it's been a couple years since I've had to do it; perhaps installation on newer desktop Linux distros, with the newer package managers, are less painful than I remember. Without these newer Windows installers, WIMP would have been more of a pain in the butt.


