Full-size photos not working on WordPress with IIS7

I thought I had all the weird caveats figured out when hosting WordPress on IIS7.  It looks like there’s another one.

Apparently by default you cannot view full-size images uploaded through the WordPress interface.  You can show the thumbnails, but not the full-size version.  The full-size version is completely blank.

This can also be demonstrated if you have a gallery plugin installed.  We could easily upload images, and the thumbnails displayed, but whenever I tried to open the full-size image, I would get stuck at a “loading” screen.

I logged into the server to verify that one of the offending files actually exists, and it did.  I tried to open the file and received an “Access Denied” message.  Apparently there is a permissions issue.wp-content_properties

In addition to the other permissions you have to set in Server 2008 to work properly (especially if you want to update your themes and update plugins through the interface), you also have to make sure that IIS_IUSRS has read access to the directories. I recommend giving read permission to the entire wp-content folder so you never have to run into this issue again.

After I did this, all of my full-size images appeared, but newly uploaded files still had the permission issue.  It looks like WordPress doesn’t have permissions to the original file it is thumbnailing.

To squash this, you need to make sure the IIS_IUSRS user has full access to the upload path that PHP is using.  Look at your PHP.INI to see where the upload_tmp_dir is pointing to.  If it’s not specified then you’ll have to create one and grant the permissions (I have no idea what the system default is supposed to be).

So, in the Security tab of wp-content, make sure that

  • The Users group has read access (and modify access if you want to update config files through the WP interface)
  • IIS_IUSRS has read access (you may have to add this group
  • IIS_IUSRS may need full access to your PHP uploads directory

If none of these do not work, then you can try to delete and recreate your wp-content directory.  This is what eventually worked for me.  I moved this blog over from a Server 2003 to Server 2008 installation, and apparently permissions can get screwed up.  Move your wp-content directory to another location, then recreate the wp-content folder in your blog.  COPY your files back over, and then flush your browser cache, restart your browser and try again.  This is what eventually worked.

I’ve been knocking down all the obstacles of running WordPress on a Windows server one by one.  I even have features that even Linux server cannot use… like the ability to use output caching AND URL rewrites at the same time… and the output caching is much more granular than Apache’s mod-rewrite (usually need to disable it on the admin and gallery directories).

There are a few other little caveats that I’m working on… like a MySQL error whenever saving a post with the Similar Posts plugin.  In all fairness, this plugin has not been updated to support WP 2.7, so it isn’t necessarially the fault of Windows.

Alan is a web architect, stand-up comedian, and your friendly neighborhood Grammar Nazi. You can stalk him on the Interwebs via Google+, Facebook and follow his ass on Twitter @ocmodshop.