IIS 7.5, WordPress and WinCache: A Match Made in Hell.

This blog has had a variety of homes over the past few years although you wouldn’t know it by looking at it. Initially it was hosted on a Windows 2008 server I built myself, sitting behind the tenuous link of my ADSL connection. Don’t get me wrong this is a great way to get started if you’ve got admin roots like me but inevitably my ADSL connection would go down or people would just plain give up waiting for it to load, what with my upstream only able to handle 100KB/s. Still for most of its life the blog remained in that configuration as I couldn’t find a hosting provider I was happy with.

Of course the day came when WordPress decided to stop playing nice with IIS and started returning internal server 500 errors. Thankfully it would usually right itself after a reboot but it was always a count down to the time when it would start erroring out again and being the busy man that I am I never had the time to troubleshoot it. Eventually I caved and set up an Ubuntu box to host it, figuring that all my woes would be solved by switching to the platform that everyone expects WordPress to run on. I’ll be honest it was a good change as I could finally use all the caching plugins, and traffic took an upward trend thanks to the faster loading times.

Unfortunately that didn’t last particularly long either as whilst the blog was particularly zippy the Linux VM would sometimes stop responding to requests and would only start behaving itself after a reboot. The cause of this I’m still not sure of as the VM was still up but it just refused to keep on serving web pages, including all the funky admin tools my PHPMyAdmin and Webmin. It was around this time I found myself in possession of a shiny new VPS that was only hosting my fledgling app Lobaco so I figured a small time WordPress blog wouldn’t be too much for it to handle. Indeed it wasn’t and the blog has been steaming along on it ever since.

However the unfortunate internal server errors returned eventually and whilst I was able to get around them with the trusty old reboot a couple times they became more persistent until I eventually couldn’t get rid of them. After digging around in the event logs for a while I eventually stumbled across references to php_wincache.dll which upon googling lead me to posts like these, showing I wasn’t alone in this internal server error hell. Disabling the plugin fixed the problem and all was well with the world. Of course many months later I found myself  trying to optimize my blog again and I started looking at the things I had removed in order to keep this thing up and running.

The first was the caching plug-ins which are unequivocally the best thing for performance on a dynamic PHP site. The vast majority of WordPress caching plug-ins don’t play nice with Windows as they make the assumption they’re on Linux and attempt to write files in all sorts of whacky locations that simply don’t exist. WP-SuperCache, although still suffering from some Linux based assumptions, can be wrangled into working properly with IIS and has been doing so for the past couple months. I also found that WinCache had been updated since I had unceremoniously removed it from my php.ini file so I decided to give it another try. Again everything was rosy for a time, that was until last weekend.

I fired up my blog on Saturday to find the home page coming up fine but I was logged out for some reason. This happens from time to time so I wasn’t worried but trying to login left me with the dreaded internal server 500 error. Poking around it looked like any non-cached page was failing meaning the majority of my site was unavailable. The event logs showed the dreaded WinCache dll failing again and disabling it brought my website back around again. It seems, at least for now, that I’ll have to give WinCache a miss as the last update to it was almost 3 months ago and its past performance has led me to believe that it’s not entirely stable.

So if you’re crazy like me, trying to run WordPress on IIS and all, and you’re WordPress blog seems to take a dive more often than not make sure to get rid of WinCache at least until they get their act together. I haven’t delved into my previous VMs to see if it was the culprit back then but my most recent set of problems can be traced directly back to WinCache wrecking havoc by attempting to cache PHP objects and if this post can save 1 person the headache of trying to track it down I’ll consider it a huge success

13 Comments

Leave a Comment
  1. Sorry to hear you are having troubles using WordPress on IIS with Wincache. The issues you describe is a little confusing and I’d like to get some more information. Are you able to post your php error log and your IIS log for when you were getting these errors?

    Wincache by itself is simply an opcode cache for PHP, by itself it does not cache pages or content in WordPress so the situation you describe is a bit confusing to me.

    An option with Wincache is to use the WordPress Wincache Object Cache Plugin which is based upon Mark Jacquith’s APC Object Cache Plugin, http://wordpress.org/extend/plugins/wincache-object-cache-backend/

    There is also the W3-Total Cache which is basically a Swiss Army Knife of caching and performance optimization technologies for WordPress. http://wordpress.org/extend/plugins/w3-total-cache/

    Also, Microsoft has a huge listing of hosting providers, all of whom support running any of the applications in Microsoft’s Web Application Gallery (including WordPress) on Windows/IIS with MySQL. I found this provider which might be suitable for you, http://www.microsoft.com/web/hosting/HostingProvider/Details/284 you can take a look at all of them here http://web.ms/hosting, select PHP and MySQL from the technologies drop down on the left.

    Hope that helps. I run a bunch of WordPress sites on Windows and IIS. It works great for me. I get great performance out of them and there are a number of great hosting companies who do WordPress on Windows.

  2. Hi Mark, thanks for taking the time to come and comment on my post.

    More than happy to post up the logs for you to have a look at. I’ll update this comment when I’ve got them uploaded for you. I had a quick look at the php log when I was troubleshooting this and the only entries in there referenced the php_msssql.dll, nothing to do with WinCache.

    Oh I never meant to say that WinCache was caching pages (I use WP-SuperCache for that) just that I noticed there was a problem when cached pages were showing up but non-cached ones weren’t. This is what lead me to WinCache as the culprit as since it won’t be invoked with cached pages, only on the ones where PHP was being used.

    I saw the plug-in after I went through the troubleshooting on the weekend. I’ll try re-enabling WinCache with the plugin installed to see if that helps with the errors.

    I’ve tried W3-Total Cache in the past and had a lot of trouble getting it to work with IIS (although it worked brilliantly on Linux/Apache). That might’ve changed in the year or so since I used it, but WP-Super Cache seems to be working fine for me now.

    I’m actually with SoftSys Hosting for my current VPS and they’ve proven to be the best value on the market for VPSs. Sure it’s not hosted in Australia but the physical location doesn’t matter that much to me as long as the uplink is a decent speed.

    In general I’m quite happy with the performance of WordPress on IIS, especially when you use a caching plugin. It just seems that WinCache causes some major stability issues, at least on my sites. If this can be fixed that’d be fantastic and I’ll gladly offer up my services as a guinea pig to test it 🙂

  3. Hello,

    Need help A.S.A.P wincache Project at Source Forge reviews comments.

    Come to the IIS Forums and help.

    I am Martin Rasch aka HCamper at the IIS Fourms.

    I am a IIS Forums community member.

    I see your working with wincache can you help in the forums.

    The Thread Topic is “Are we dead…” http://forums.iis.net/t/1176586.aspx

    Can users the PHP Community or others help out add to the discussion

    constructive postive help is needed.

    TIA,

    Martin Rasch

  4. Martin,

    I’m not really in a position to help out here as I stopped using WinCache as of this post (I tried the plug-in mentioned by Mark to no avail) and I have no involvement in the PHP scene whatsoever. Personally I advise people against using WinCache because of the issues I’ve had with it and mostly just recommend running their WordPress sites on Linux if they can swing it.

  5. I am very surprised at this conclusion. I use WinCache with iis 7.5 and wordpress and it works very well even better than SuperCache.

  6. It’s highly likely that it’s something to do with the configuration of WinCache as whilst I set up most things I didn’t do the base install of the OS nor the configuration of the add-ons. That being said I’m not sure what I could change in order to get it to work as it’s just a line in the PHP.ini file but I’m open to suggestions.

    It might be worth looking at again as I was running some 20 other websites on this same host when I was encountering these issues but I have since deactivated them.

  7. My apologies for replying to such an old post. As “al mare”, I’m surprised too. Suppose you’d use WinCache again, would you run into problems again?

    True, there have been a lot of problems with WinCache (like not being able to update plugins) and various PHP versions, and the success depends on what WinCache and PHP versions you use. When you have a stable set up, stick with that for a while. I administer a lot of Windows webservers (IIS 6.0, 7.5 and 8.0) and have several WordPress websites running PHP 5.3 and 5.4 with WinCache. Everything is running very smooth. I’d be happy to share information about configuration settings.

  8. Who knows Jan, the set up I was using previously was set up by the VPS provider I was using so I wasn’t entirely sure of what configuration changes they had made to get it to where it was in the first place. I only knew that WinCache was there and causing issues because of the troubleshooting steps I had gone through, I didn’t even know it existed before then.

    I’m running this blog from a Linux VPS now and it’s running a lot better, especially with all the plugins that I use. I probably wouldn’t want to run WordPress on Windows again due to many plugins assuming Linux hosts but I’m glad to hear that you’ve got them running smoothly. Have you blogged about your experience in setting it up? I’m sure there’s a lot of people out there that would find that useful 😀

  9. @David Klemke Glad to hear your blog runs fine on a Linux VPS 🙂 If only plugin writers learn to write cross platform, and secure, code instead of only for Linux/Unix. In my opinion, PHP runs as good on IIS as on Linux/Unix with Apache nowadays.

    In the past, there have been a lot of problems with buggy WinCache versions, like issues with file change notifications (cached versions of files were not released after a new version of the file -or WP plugin- was placed), and the development of new releases was very slow. Currently I’m still using an older Beta-version for PHP 5.4 and haven’t tried the release version yet (haven’t gotten around to it).

    You can view WinCache settings by placing the wincache.php file in your webroot; download the Wincache-extension and extract the executable, the .php-file is there. Also phpinfo() provides some setting-information.

    I’ve just created a quick “How to set up PHP 5.4 with WinCache on IIS 7 / 7.5 / 8.0” post and setting it up is pretty straightforward: http://www.saotn.nl/how-to-set-up-php-5-4-with-wincache-on-iis-7-75-80/

  10. Yeah it was definitely a source of major headaches on this blog when I’d want to do something only to find out that there were hard coded Linux references in plugins that would stop them from working. Granted the majority of the WordPress userbase uses Linux but it’d still be nice if developers made their code slightly more portable rather than straight up assuming.

    I tried a couple different versions when I was trying to troubleshoot it and they all eventually ended up with the same result of my blog keeling over. This post is well over a year old now so things may have changed in the interim but I had long since resigned myself to migrating to Linux once the contract on my old VPS ran out.

    Good post, I’m sure that’ll help out those who are looking to squeeze a bit more out of their Windows based WordPress blogs 🙂

  11. Sorry to hear that Faiq. Unfortunately I’ve never found a way to make it work but I managed to get my site running pretty smoothly without it.

    I’m on a dedicated WordPress hosting service now though, they take care of all these things for me! 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.