December 21, 2005

How to configure WordPress on an IIS 6.0 shared host

Filed under: HowTo, WordPress, Development, Systems Engineering, Configuration | Lindsay @ 11:10 am

I have a confession to make. Linux intimidates me. And I am also afraid of using a hosting service other than my favorite, Crystal Tech, because they have given me outstanding service for more than 6 years. So when I decided that I wanted to start blogging again and was convinced that WordPress was the best option, I knew that I needed to find a way to make it work on my account at Crystal Tech.

Crystal Tech is a Windows based ISP. That works fine for me. I have been a Windows developer my entire career. It’s what’s comfortable. So I was disappointed when I was told that WordPress doesn’t fully work on Windows unless you run Apache. Turns out it’s possible after all. It just takes a few extra steps.

I ran into 3 problems after following the “five minute install” as defined in the WordPress 1.5.2 install readme:

  1. After logging in sucessfully the first time, every time I clicked a link or tried a url without an explicit page I received an HTML 403 Forbidden “You do not have permission to view this page” error
  2. Permalinks did not work correctly, also giving me HTML 403 errors
  3. Emails were not being sent even though several events (including new comments) were configured to trigger them

Forbidden Access

The first issue I thought could be solved by changing the IIS or file system permissions on the folder I installed WordPress in and its children, but they already had the appropriate permissions set (Everyone: read and execute).

It turns out that it was an issue with the folder’s default pages list. When you navigate to an IIS virtual directory and the directory is not set up to allow you to brows files, IIS searches for and serves up the first file it finds in the directory that is on its default pages list. The standard items in that list are default.html, default.asp or (if .Net framework installed) default.aspx. Since WordPress is PHP based, none of these apply, of course. So the solution to the first problem was simply adding index.php to the default pages list for the root WordPress folder.

Broken Permalinks

The permalinks issue is apparently a fairly common complaint. I scoured the forums at Crystal Tech and only found people asking how to solve it, one guy saying he’d given up and switched hosts because it was so important to him. There was a work-around involving a couple of lines of configuration info to be included in the php.ini file. But this file is not accessible from a shared hosting account and apparently affects all accounts on the shared server so the technical support would not make the change.

I found the solution in the second post on an issue in the WordPress forum. Create your own php.ini file with the following two lines of text:

cgi.fix_pathinfo = 1
cgi.force_redirect = 0

Place your php.ini file in the root of your hosting account.

Then add a url structure for your archive path in WordPress under Options->Permalinks.
Here’s an example:

/index.php/%year%/%monthnum%/%day%/%postname%/

Permalink problem fixed!

No Emails

The email issue was the toughest. Again many people had stated they were having the problem but there weren’t many good solutions offered. There is no way that I could figure out (being a newbie to PHP and WordPress) to even find out what error was being thrown so I could research it. The solution ended up being a combination of a couple of things.

First someone suggested that I install a plugin called wpPHPMailer which bypasses WordPress’ default of using PHPmail and uses Sendmail (SMTP) instead. The plugin install was simple and straightforward but I still wasn’t getting emails.

Then I found another post where someone (apparently on their own server or a dedicated hosting account) modified the php.ini with some SMTP configuration information like so:

[mail function]
; For Win32 only.
SMTP = mail.YourDomainOrSmtpServer.com
smtp_port = 25 

; For Win32 only.
sendmail_from = RealEmail@YourDomain.com

So I added these lines (configured for my own situation, of course) to my php.ini file that I created for the permalink issue and everything works fine!

All better now…

I believe the permalink and email issues are on the development list for WordPress 1.6 2.0 so maybe when it’s released this article will be obsolete. In the mean time, maybe this information will be helpful to someone else who is going through the same pain.

Happy WordPressing!

Update: As far as I can tell, this article still applies to Wordpress 2.0.

» » » » » » » » » » » » » »
, , , , , , , , , , , , ,

11 Responses to “How to configure WordPress on an IIS 6.0 shared host”

  1. Basil Vandegriend Says:

    Yup, your article still applies to WordPress 2.0. However, it is now possible to have permalinks that don’t contain “index.php”, since WordPress 2.0 no longer modifies the .htaccess file to manage permalinks - it handles it internally. See my post for more details: http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis

  2. Lindsay Says:

    Thanks for that info, Basil. Not having to use the index.php in the permalink format will be nice and I didn’t try it out when I upgraded so that’s new info to me!

  3. wedding speeches Says:

    Your website has imparted a lot of knowledge.Thanks!

  4. WaltDe Says:

    Very good reading. Peace until next time.
    WaltDe

  5. las vegas wedding chapel Says:

    I am not sure if I agree with that last post.

  6. Web Design Says:

    I never fail to be amazed by the generousity of people like you that give so much free information back to the community. Thankyou.

  7. Estetik Says:

    Great Tip! :-) Thanks I liked your theme.
    I thinkyou are awesome.

  8. maid of honor speech Says:

    Dude! You made my day - I mean MONTH! I was struggling with this very issue. In fact, I figured out the first issue on my own by making index.php part of the default look-up tables - but man, the rest is what saved my bacon - THANKS!

  9. ultimate content creator Says:

    I had already switched over to Linux by the time I stumbled onto this page - However, I may set up a future site I have been thinking about on IIs.

    Thanks for this informative post.

  10. web design uk Says:

    Great tip regarding the broken permalinks issue using php ini. Finding this post just saved me a whole load of time! Cheers :)

  11. Leonardo Medina Says:

    I have windows host as well but it is working very good with almost all my wordpress blogs. I have been using servergrid for more than 2 years and they have no issues with wordpress. I am wondering what type of windows host you are talking about.