Drupal 7 on Windows

I have a fairly reasonable “WIMP” stack (Windows, IIS, MySQL, PHP) running on my work machine now, and I wanted to document how I got there, for future reference, or for anyone who might stumble across this blog post. My setup has evolved over time, so I’m not 100% sure if these instructions would work exactly right from scratch.

There are some ways to get a Drupal-compatible “WAMP” stack (Windows, Apache, MySQL, PHP) running on Windows pretty quickly, but most of the stuff you really need to do in Drupal works OK in IIS. And I think that the approach I outline below gives you the most flexibility in terms of also using the components for stuff other than Drupal.

In these instructions, I’m creating a Drupal site named “drupal-7-test”, but it doesn’t really matter what you call it.

  1. Get Web Platform Installer from http://www.microsoft.com/web/platform/.
  2. Use Web Platform Installer to install “IIS 7 Recommended Configuration.” You may also need to install URL Rewrite if you don’t already have it.
  3. Install MySQL via the MySQL Installer for Windows. (Do not use Web PI.) Select “developer default” to get the MySQL Server, Workbench, and a few other useful things. For configuration, select “developer machine.”
  4. Install PHP 5.3.x from http://www.microsoft.com/web/platform/phponwindows.aspx with Web PI. (This will pull in a few other necessary components.) (Do not install the PHP for WebMatrix — click the link on the above page.) (Oh, and the page still says “PHP 5.3.5,” though the actual installer has been updated to a more recent version.)
  5. In IIS Manager, go to “default web site” and click “PHP Manager”. Make a note of the location of the config file and the error log. Click “configure error reporting” and select “Development machine”. Click Apply.
  6. Get phpMyAdmin from http://www.phpmyadmin.net and unzip it to c:inetpubwwwrootphpmyadmin. Go to http://localhost/phpmyadmin and run through the setup.
  7. In phpMyAdmin, create a user named “drupal_7_test”. Click the checkbox to also create a database of the same name, and give that user all rights to it.
  8. Get Drupal 7 from http://drupal.org/download and unzip it to c:inetpubwwwrootdrupal-7-test. (The standard Drupal 7 download includes a web.config that enables clean URLs for IIS, given the MS IIS Rewrite module.)
  9. Give IIS_IUSRS modify rights to sites/default/files.
  10. Go to http://localhost/drupal-7-test and run through the setup. Use the MySQL database & user created earlier.
  11. Go to the status report in the Drupal admin and check that everything is working OK.

Random follow-up notes
It’s June 10, and I’m setting up a WIMP environment on my ThinkPad. I’ve also recently set up a WIMP environment on my new work desktop, so I’ve got a few follow-up notes on this post.

  • You may need to enable CGI on your machine, if it’s not already enabled, to get PHP working. See here for details.
  • As an alternative to the full MySQL installer I linked to above, you can also use the stripped-down version that can be found here.

Windows backup weirdness

I hadn’t done a backup of my main home desktop PC in a while, so I decided to get one done today. I’ve previously used the built-in Windows 7 Backup, and, more recently, Crash Plan. I’ve had problems with both, so I needed to find another backup program.  I have a 1 TB drive, about 70% full, and two 500 GB drives that I can use for the backup. So, I need a program that can split the backup across two drives, which turns out to be more of a limiting factor than you’d think it would be. I’m currently running a backup with Macrium Reflect Free, which *should* be able to split the backup between two drives, though I’m not sure if it will or not.

The “weirdness” referenced in the title of this post is with regard to the speed of the backup. This is a desktop PC, and I’ve never really tweaked the power settings on it. I have the display set to blank after 10 minutes, but my assumption has always been that the PC will keep running at full speed, if it’s doing something, like a backup. When I started the backup, it was running at about 300 Mb/sec. That seemed like a good speed, and I expected it to get done fairly quickly. I’ve noticed, though, that if I check on it after it’s been running for awhile, it shows at 100 Mb/s.  If I sit in front of it for a few minutes, it gets back up to about 300 Mb/s. But, if I step away for an hour, then come back, it’s back down to 100 Mb/s. So, clearly, something is happening to slow it down after a certain period of keyboard/mouse inactivity. So, I’ve switched the power settings from “recommended” to “high performance”, thinking that maybe it’s going into a low-power mode or something, but I don’t think that’s helped. Which could mean that some other background process is kicking in after a few minutes of keyboard/mouse inactivity and slowing things down. All very frustrating. We’ll see if I can manage to get a backup done before the NFC Championship game is over.

new laptop – initial impressions

So I got my ThinkPad E520 today, and I thought I’d write up some initial impressions.

  • It’s lighter than I thought it would be. I guess it’s mostly plastic, and the battery isn’t huge, so that must be why. It feels weird though.
  • This is the first laptop I’ve ever bought that had a numeric keypad as part of the keyboard. (Well, technically, I had a barely portable Amstrad back in the early nineties that had a full-size keyboard with numeric keypad, but that wasn’t really a laptop.) This also feels a bit weird.  When I’m typing, my fingers aren’t in the middle of the laptop, they’re in the middle of the main part of the keyboard, which is a bit left of center. And the trackpad  is centered under the main part of the keyboard, so that too is left of center. I think I’ll be able to get used to it, but it does feel weird right now.
  • The keyboard isn’t bad, but, given the size, I wish they’d gone with a more conventional key layout.  Ins, Del, Home, and End are up on the top row, but PgUp and PgDn are tiny little keys on either side of the up arrow key.  (On the plus side, they did maintain the inverted T arrow key layout.)
  • This laptop has the Lenovo “Enhanced Experience“, which is supposed to speed up boot time. My experience so far is about 45 seconds to the login screen, then 45 more seconds to the desktop after entering my password. Not bad, I guess, but not stunning.
  • This machine has a fingerprint reader.  I set it up to allow me to login with a swipe of my index finger, but it hasn’t worked so far.  I might need to go through the setup wizard again.
  • Lenovo tends to ship a bunch of proprietary utilities on their machines.  This one has a handful of programs pre-installed, but only a few are really useless and need to be uninstalled. 
  • I’ll definitely be uninstalling Norton Internet Security.  I’ll probably install F-Prot for anti-virus protection. I’ve been using it for several years on all my machines with no problems.

So those are my initial rambling thoughts.  I’ll probably post more in a few days, when I’ve gotten a bit further with it.

    old laptops

    Once I get my new Lenovo, I’m going to get rid of my old Dell Inspiron and my Acer Aspire One. For some reason, whenever I’m getting rid of a computer, I like to go back and review some stuff — when I got it, how much I paid for it, whether or not I feel like I’ve gotten my money’s worth out of it, and so on.

    I bought the Inspiron in February 2007, so that makes it about four and a half years old. I usually consider three years to be a decent life span for a laptop, so this one has certainly lasted long enough. I bought it through the Dell EPP (Employee Purchase Program), back when I was at NMS, my previous job. I was surprised to see that I spent $2000 on it. That seems like a lot now — the new Lenovo is only costing me $550, and it’s a pretty good machine, not a refurb or anything. I got a fair bit of use out of the Inspiron. I took it on a few trips, both personal and business, and I used it a lot when my Mom was in the hospital (and later the nursing home).

    I bought the Acer Aspire One from Woot in July 2009, so it’s only about two years old. I never did get much use out of it. At this point, most of the scenarios where I could see myself using a netbook, I’m more likely to just go with the iPad. I think, for me at least, the iPad really killed any need for a netbook. If I need a full-featured computer, the netbook isn’t good enough, and if I don’t, then the iPad is easier to lug around and use.

    I turned the Aspire One on today, to make sure it was still working, and I took a look at the event log. The last time I had it turned on was March 30. So, five months without any use pretty well indicates that I don’t need the thing. I’ve occasionally thought about wiping out Windows on it and installing Flow or UNR on it. If I did that, though, it would just be for fun; I don’t see any real utility in using either of those on a regular basis.

    new laptop

    I just ordered a new laptop from Tiger Direct — a Lenovo ThinkPad Edge E520 1143-3FU. (Heck of a name, huh?) It was only $550, and has a couple of things I want that aren’t usually included in most consumer laptops: Windows 7 Pro (instead of Home), and a 7200 RPM drive.
    This will be replacing my Dell Inspiron, which is old enough that it has a PATA hard drive, and can’t be upgraded past 2 GB.
    I actually don’t use my Windows laptop that much — I use my MacBook for everyday use, like reading email, surfing, writing blog posts, and stuff like that. I still feel like I should have a reasonably up-to-date Windows laptop on hand, and this Lenovo wasn’t too expensive, and should hopefully last me for a few years.

    PowerShell script to view SMTP server WMI stats

    I’ve been playing with PowerShell a bit lately. Here’s a script I wrote today that extracts some info about the standard Windows Server SMTP service, does a little formatting on it, and sends it out to someone via GMail. (I’m sending it via GMail, since the purpose of the script is to determine if there’s anything weird going on with the SMTP service, and if there is, then it doesn’t make sense to use it to send the status e-mail.)

    function sendmail
    {
        param ($msgtext)
        $EmailFrom = "someone@somewhere.com"
        $EmailTo = "someone@somewhere.com" 
        $Subject = "SMTP Stats" 
        $Body = $msgtext
        $SMTPServer = "smtp.gmail.com" 
        $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
        $SMTPClient.EnableSsl = $true 
        $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("somebody@gmail.com", "password"); 
        $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
    }
    
    $smtp1 = gwmi Win32_PerfFormattedData_NTFSDRV_SMTPNTFSStoreDriver | ? { $_.Name -eq '_Total' }
    $smtp2 = gwmi Win32_PerfFormattedData_SMTPSVC_SMTPServer | ? { $_.Name -eq '_Total' }
    $Date = Get-Date
    $output = "-----------------------------------------------`n" 
    $output += "Stats from " + $smtp1.__SERVER + " on " + $date + "`n"
    $output += "----------------------------------------------`n"
    $output += "Messages in queue dir: " + $smtp1.Messagesinthequeuedirectory + "`n"
    $output += "Remote queue length: " + $smtp2.RemoteQueueLength + "`n"
    $output += "Remote retry queue length: " + $smtp2.RemoteRetryQueueLength + "`n"
    $output += "`nBadmail:`n"
    $output += "`tBadPickupFile: " + $smtp2.BadmailedMessagesBadPickupFile + "`n"
    $output += "`tGeneralFailure: " + $smtp2.BadmailedMessagesGeneralFailure + "`n"
    $output += "`tHopCountExceeded: " + $smtp2.BadmailedMessagesHopCountExceeded + "`n"
    $output += "`tNDRofDSN: " + $smtp2.BadmailedMessagesNDRofDSN + "`n"
    $output += "`tNoRecipients: " + $smtp2.BadmailedMessagesNoRecipients + "`n"
    $output += "`tTriggeredviaEvent: " + $smtp2.BadmailedMessagesTriggeredviaEvent + "`n"
    # $output
    sendmail($output)
    

    I still don’t really know PowerShell that well, but I’m learning. I picked up most of the info I needed to write this script from StackOverflow and Hey, Scripting Guy.

    DropBox

    I finally decided to switch from Windows Live Sync (aka FolderShare) to DropBox. I’ve got it installed on my desktop, Dell laptop, MacBook, and Acer netbook now, and I’ve moved everything from FolderShare to DropBox.

    The main problem with FolderShare is that it doesn’t actually store any of your stuff, it just enables you to sync a folder between shared computers. So, to sync two computers, for instance, you need to have them both turned on and connected to the internet at the same time. For me, this has been leading to occasional problems, where I wind up with two versions of the same file, or I need to turn on my desktop computer to get the latest version of a file down to my laptop, for instance.

    DropBox stores your stuff in the cloud, so it shouldn’t be a problem to get a shared file from one computer to another without needing them both on at the same time. We’ll see how it works in practice, but so far, so good.

    more Virtual PC grief

    I booted up my main Windows XP VPC this morning, and it appears that some corruption occured on the virtual disk at some point in the process of moving from VPC 2007 to Windows 7 VPC. There was a problem at one point yesterday, where Windows XP did a CHKDSK and (I thought) fixed a bunch of errors. But now, when I try and go into User Accounts in Control Panel, I’m getting weird errors, so I think some XP files got hosed. I’m now doing a repair install of Win XP to try and fix this. I’m really starting to think that VPC is more trouble than it’s worth, but I’ve invested enough time in it now that I should at least try to follow through for a while longer.

    getting there

    I’m vaguely proud of myself. I’ve got the new machine almost completely set up now. (When did we get to the point where it takes 3 or 4 days to get a new computer set up?) I’ve got Visual Studio 2008 and SQL Server 2008 on there, both patched to current levels. I’ve got my TomTom One GPS working, and my BlackBerry Storm working (after some grief with the USB mass storage mode). My iTunes library is in place and synced to my Apple TV again. Outlook is all hooked up, and can send and receive e-mail, no problem. I’ve made recovery DVDs, so I can reinstall Windows, if I ever need to. I’ve got most of the HP crapware either uninstalled or at least out of the way so it doesn’t launch on startup. Ditto for all the weird stuff that got installed with the new Canon printer. (Speaking of which, I have the drivers installed on my Dell Inspiron and my MacBook too now, so I can print from either of those.) Even with all that, I’ve still got a few things left to do. And, after all this work, I really need to image this hard drive, just in case.