12

WordPress File Uploads With IIS

Posted on September 4th, 2007 /
Tags: ,

I didn’t have any problems getting WordPress to work on Windows Vista, IIS7 and PHP 5 (ISAPI). That is, until I tried to upload an image. After hunting around and gathering tips and ideas from others here is what I had to do:

  1. Edit upload_tmp_dir option in php.ini. In my case I created an uploads folder in the wwwroot: upload_tmp_dir = “c:\inetpub\wwwroot\uploads”
  2. Create the c:\inetpub\wwwroot\uploads folder and grant the IUSR full control of it
  3. Create the uploads folder in your wp-content folder, for me this was in c:\inetpub\wwwroot\wordpress-trunk\wp-contents\uploads, then grant the IUSR full control of it
  4. Restart the IIS service (to pick up the php.ini change)

After that I was able to upload files in WordPress running under Vista and IIS7. I haven’t tried to fine tune the permissions issue, it is possible that this can be done without having to grant full control of those folders to the IUSR account.

Tags: ,

12 Responses to “WordPress File Uploads With IIS”

  1. September 4th, 2007 at 11:09 pm Jim

    Sounds like a lot of work. Maybe you should have stuck with Apache. ;)

  2. September 5th, 2007 at 10:20 am Mike Volodarsky

    Actually, you should be happy that the IIS worker process does not have the right to write to your application’s directory by default :)

    This is one of the key defense-in-depth protection measures against website defacement via application-specific exploits that may exist in your application code.

    Joseph, if you are feeling adventurous, you can try running Wordpress using the latest FastCGI technical preview, which will be the recommended way to run FastCGI on Windows Vista SP1 and Windows Server 2003. You can learn more about this here: http://mvolo.com/blogs/serverside/archive/2007/05/29/The-latest-on-the-FastCGI-project-and-PHP-support-on-IIS.aspx

    If you are interested in trying it out on Windows Server 2003 Beta3 (free download), FastCGI is built-in there. I recently set Wordpress up on it: http://mvolo.com/blogs/serverside/archive/2007/08/12/IIS-Authentication-plugin-for-the-Wordpress-PHP-blogging-engine.aspx

    Thanks,

    Mike

  3. September 5th, 2007 at 10:41 am Joseph Scott

    @Mike-

    Oh, I wasn’t complaining about the permission issue, just noting it for others who might have run into the same problem.

    Thanks for the links on FastCGI with IIS and PHP, I might try that out later. My IIS with PHP setup is only for WordPress development, nothing production wise. For those needing better performance though I could see that being very handy.

    Now if only I could figure out why I get the occasional error about IIS worker threads dying I’d have less interruptions :-)

  4. September 13th, 2007 at 6:20 pm Nico Nemil | Filipino Web Developer | Pinoy Web Designer | Intermediate Graphics Artist » WordPress File Uploads With IIS 7

    [...] File Uploads With IIS 7 WordPress File Uploads With IIS: Joseph figured out how to fix permission issues with IIS 7, PHP 5 and Windows Vista. This might [...]

  5. September 13th, 2007 at 7:21 pm n-blue

    Is this apply to Windows Server 2008 too?

  6. September 13th, 2007 at 7:24 pm Joseph Scott

    @n-blue

    I don’t see why not. I don’t have a Windows Server 2008 to try it out on so I can’t confirm if there are any specific differences or not.

  7. September 25th, 2007 at 1:03 pm Mike Volodarsky

    Scott,

    What is the thread death error you mention - are you getting this on IIS7 when using the PHP ISAPI? If you post more information on this, I may be able to help you out or direct you to Zend for more help.

    Thanks,

    Mike

  8. October 9th, 2007 at 8:03 pm Jody Sachse - Wandering the Webernet

    [...] WordPress File Uploads With IIS: Joseph figured out how to fix permission issues with IIS 7, PHP 5 and Windows Vista. This might help someone in the future. Up? Something to say? [...]

  9. April 20th, 2008 at 1:12 pm 10 Reasons Why Not to Host Your Wordpress Blog on a Windows/IIS Platform

    [...] pointed them to three blog entries that address exactly this issue: IIS permissions for uploading, WordPress File Uploads With IIS, and Installing Wordpress on IIS [...]

  10. May 5th, 2008 at 7:12 pm This Everlasting Spoof » WordPress 2.1 Image Upload Problem

    [...] May 5, 2008WordPress 2.1 Image Upload Problem After upgrading to Fast-CGI, my WordPress 2.1 image upload tool started asking for a password every time a image was uploaded.  Turned out to be a permissions issue with WP/Fast-CGI-IIS that was solved by following the steps below from Joseph Scott’s Blog. [...]

  11. May 13th, 2008 at 12:50 pm Anthony Foust

    I followed your instructions and WP will let me upload pictures just fine. The problem I have is that once the picture has been uploaded it won’t display for some reason even thought IUSR has full control over that content folder. What I find out is that the permission are not propagating to the file level until I manually tell it to propagate each time I upload a photo. Has anyone had any problems like this?

    My Setup:

    Windows 2008 Enterprise w/ IIS 7 w/ FastCGI
    WordPress 2.5.1
    Latest MySQL
    Latest PHP 5

  12. July 20th, 2008 at 9:40 am Sprogz

    @Anthony,

    I have exactly the same problem with images being unviewable after upload due to failure to propagae permissions to the year/month folders WordPress creates to store the uploaded images.

    Did you ever find a solution?

    Thanks?

Leave a Reply

Ads