Simmons Consulting, the Website of Toby Simmons

Fixing WordPress 1.5 on Windows 2000 (IIS 5)

13
Feb

EDIT: 2005 May 9 — The official fix is out! Download 1.5.1!

Well, I’ve upgraded to WordPress 1.5 and things seem to be going pretty well. I did have to spend the better part of a day trying to figure out why I couldn’t either log in to my admin page from a computer that hadn’t logged in yet, nor could I log out from a computer that was normally logged in. Turns out there is a problem setting a cookie and sending header redirection (a “location:” header) from the same Php file on a Windows 2000 Server (IIS 5).

But there is a workaround. It takes a few manual edits, but I think it fixes most of the problem. — EDIT: 2005 Mar 13 — Please note that the changes I outlined below have become outdated. I have created a zip file with all the necessary changes as will be implemented in the official release of WP 1.5.1. You can download the zip file from my site.

While the changes below work, they are NOT the accepted method for fixing this problem. Please instead use the files contained in the zip file I am providing above.


Starting with the wp-login.php file, open in a text editor and make the following changes:

Line 185: Change this:

  1.       header("Location: $redirect_to");

to this:

  1.       // Start of IIS fix by Toby
  2.       //header("Location: $redirect_to");
  3.       if (strstr(php_uname(), 'Windows'))
  4.          header("Refresh: 0;url=$redirect_to");
  5.       else
  6.          header("Location: $redirect_to");
  7.       // End of IIS fix by Toby

Line 30: Change this:

  1.    header('Location: wp-login.php');

to this:

  1.    // Start of IIS fix by Toby
  2.    //header('Location: wp-login.php');
  3.    if (strstr(php_uname(), 'Windows'))
  4.       header("Refresh: 0;url=wp-login.php");
  5.    else
  6.       header("Location: wp-login.php");
  7.    // End of IIS fix by Toby

Now, open up the wp-pass.php file and make the following changes:

Line 10: Change this:

  1. header('Location: ' . $_SERVER['HTTP_REFERER']);

to this:

  1. // Start of IIS fix by Toby
  2. //header('Location: ' . $_SERVER['HTTP_REFERER']);
  3. if (strstr(php_uname(), 'Windows'))
  4.    <del dateTime="2005-02-21T23:18:1906:00">header("Refresh: 0;url=$_SERVER['HTTP_REFERER']");</del> // props to nate!
  5.    header("Refresh: 0;url=".$_SERVER['HTTP_REFERER']);
  6. else
  7.    header('Location: ' . $_SERVER['HTTP_REFERER']);
  8. // End of IIS fix by Toby

Then, open up the wp-comments-post.php file and make this change:

Line 55: Change this:

  1. header("Location: $location");

to this:

  1. // Start of IIS fix by Toby
  2. //header("Location: $location");
  3. if (strstr(php_uname(), 'Windows'))
  4.    header("Refresh: 0;url=$location");
  5. else
  6.    header("Location: $location");
  7. // End of IIS fix by Toby

That should do it.

— Edit —

Okay, I found some more changes to make. Open wp-admin/link-manager.php and make the following changes:

Line 269: Change this:

  1.     header('Location: '.$this_file);

to this:

  1.    // Start of IIS fix by Toby
  2.    //header('Location: '.$this_file);
  3.    if (strstr(php_uname(), 'Windows'))
  4.       header("Refresh: 0;url=$this_file");
  5.    else
  6.       header('Location: '.$this_file);
  7.    // End of IIS fix by Toby

Line 245: Change this:

  1.     header('Location: ' . $this_file);

to this:

  1.    // Start of IIS fix by Toby
  2.    //header('Location: ' . $this_file);
  3.    if (strstr(php_uname(), 'Windows'))
  4.       header("Refresh: 0;url=$this_file");
  5.    else
  6.       header('Location: ' . $this_file);
  7.    // End of IIS fix by Toby

Open wp-admin/options.php and make the following changes:

Line 87: Change this:

  1.     header('Location: ' . $goback);

to this:

  1.    // Start of IIS fix by Toby
  2.    //header('Location: ' . $goback);
  3.    if (strstr(php_uname(), 'Windows'))
  4.       header("Refresh: 0;url=$goback");
  5.    else
  6.       header('Location: ' . $goback);
  7.    // End of IIS fix by Toby

Open wp-admin/profile.php, make the following changes:

Line 85: Change this:

  1.    header('Location: profile.php?updated=true');

to this:

  1. // Start of IIS fix by Toby
  2. //header('Location: profile.php?updated=true');
  3. if (strstr(php_uname(), 'Windows'))
  4.    header("Refresh: 0;url=profile.php?updated=true");
  5. else
  6.    header('Location: profile.php?updated=true');
  7. // End of IIS fix by Toby

Whew, that’s it for now.

Comments (81) »

  1. […] o the admin section of your newly installed WordPress/IIS setup, Simmons Consulting has the fixsky. Yeah, so that’s the geeky stuff. What’s calmighty about? Life, dirty lies […]

  2. […] rld!

    Hellz Yeah!!!!!!!!!!!

    I fixed it!!!!!!!!! thank to> https://www.simmonsconsulting.com/wpbeta/?p=160.

    This entry wa […]

  3. […] se of you that want to setup a word press, you may find this website helpful to setup the software: https://www.simmonsconsulting.com/wpbeta/?p=160 This entry was posted on Friday, April 1st, 2005 at 1:10 pm […]

  4. matt says:

    that’s brilliant. thanks!

  5. KPIZME says:

    WIERD. I had everything working ok, until I tried installing a few PlugIns. Then I got “Header” errors only to find that I had an empty line (before the opening

  6. KPIZME says:

    Thanks to Ryan over at WP Forum, I have my issue resolved. If you are experiencing issues with Plesk and wp-blog-head.php take a look
    http://wordpress.org/support/topic.php?id=29661

  7. […] that want to setup a word press, you may find this website helpful to setup the software: https://www.simmonsconsulting.com/wpbeta/?p=160 Permalink […]

  8. […] blog « Hello world! First Entry My Test. Viva https://www.simmonsconsulting.com/wpbeta/?p=160 who offered the solution for the login bug. Thanks. This entry was poste […]

  9. […] upgrade until today. Currently, I’ve got WordPress 1.5 installed with a ton of lame IIS workarounds in place. I’m up and running, thank the Lord Jesus and his minions. I&#82 […]

  10. […] accessed an “Archive”? BTW, is anyone is experiencing similar problems, here`s the page. And it`s not perfect, but it works. Functionality wins. For now. […]

  11. Todd says:

    Wow, wow, wow! This is the exact fix I had searched high and low for. Thank you, thank you, thank you!

  12. […] rom WP Plugins Get Themes from the extremely famous Pope-like Alex King’s site Use Simon’s extensive hotfix to fix fucking WordPress 1.5 and it’s IIS non-compatibilit […]

  13. […] S (and possibly Windows 2000. Needless to say that my server runs Win 2000 and IIS… Toby Simmons has a complete bug fix already posted […]

  14. […] « Almost best wysiwyg editor Log in problem How to fix LogIn issue for WordPress 1.5 on Win server: set of fixes. Very useful. Thanks io_er […]

  15. Amy says:

    Thank you a million times. You’ve just saved my sanity. ;)

  16. ryan says:

    I get the following error when trying to login to my admin page. Will the fixes on this site address my issue?

    http://www.ifihadamac.com/wp-login.php?redirect_to=%2Fwp-admin%2Findex.php

    Any help would be greatly appreciated.

    Thanks,
    ryan

  17. WinEncrypt says:

    At last! I’ve been scratching my head for hours, trying to look through tonnes of files to see if I left an extra space anywhere … Literally barking up the wrong tree/thread!

    That wasn’t the problem at all. This fix is just what I needed. Thanks a million.

  18. Andy Taylor says:

    Hi Toby,

    Running here on a W2k3 Server, IIS, MySQL and PhpMyAdmin, Can’t seem to get it past the Login. DB’s Created – 9 Tables but screen send me to a 403 Error and if I enter the Login String Directly…I get No Input Screen

    Any Help?

    Andy

  19. Ashleigh says:

    Dont suppose there are any fixes for 1.5.2 out? I cannot get permalinks and stuff working, basically anything that is index.php/something will not work (404’s)

    Any ideas?

  20. […] Fixing WordPress 1.5 on Windows 2000 (IIS 5) This guy provides lots of fixes. […]

  21. Dave says:

    Hey

    I have this issue (due to IE security and framed web forwarding) however I am running WP 2.02 – your fix no longer applies and my PHP is not good enough to rework it – would it be possible to update this fix please?

    Regards

    Dave

  22. Roxane says:

    Hi

    I don’t s’pose you have upgraded to 2.1? I’m running IIS & having the same problems you were having with 1.5. I’d love to know how to fix this…

    Thanks
    Roxane

  23. Toby Simmons says:

    Well, I’m currently running 2.0.7 (the latest in the 2.0 strain) and I’m considering upgrading to 2.1. All the earlier release candidates worked fine without any kind of fix like is shown above, they worked out of the box.

  24. Ruwan says:

    Ta This is the exact fix I had searched high and low for. Thank you, thank you, thank you!

  25. ashley says:

    I don’t s’pose you have upgraded to 2.9? I’m running IIS & having the same problems you were having with 1.5. I’d love to know how to fix this…

  26. Michael says:

    Thank you so much for this helpful post. I was putting header(‘Location: ‘ . $_SERVER[‘HTTP_REFERER’]): and not closing the Server code. I added header(‘Location: ‘ . $_SERVER[‘HTTP_REFERER’]); and it’s working fine. Thanks again.

  27. website http://www.inslyhost.co.za is running on an updated version of WordPress. check it out.

  28. website http://www.inslyhost.com is running on an updated version of WordPress. check it out.

  29. Thanks for this much appreciated

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>