Home > Posts > Fix: WordPress media uploads not working on IIS

Fix: WordPress media uploads not working on IIS

Using Microsoft Web Platform Installer (aka WebPI), one can easily install WordPress on IIS (together with PHP and MySQL database engine.

Btw, better install the latest PHP version from there and remove any older ones. Also do install from there the  Windows Cache Extension for PHP for the version of PHP you’re using.

Windows Cache Extension for PHP stores the PHP bytecode, the compiled version of the PHP script, in memory making it available when subsequent executions of the same script are needed helping to increase the overall PHP application performance. The use of Windows Cache Extension for PHP allows the PHP bytecode to be generated only once and to be reused each time the same PHP script is executed.

An issue you will definitely face is when you try to use the Media Gallery feature of WordPress to upload some media asset. It will fail due to insufficient rights to the server filesystem. You should do the following to fix this:

  1. Right click the folder wp-content\uploads at your WordPress site installation (usually it’s a separate folder under c:\inetpub\wwwroot, or it’s flat inside the wwwroot folder). Select Properties from the context menu that pops up. At Security tab of the Properties dialog window, add the user IUSR (not IIS_IUSR) and give it Modify and Write access apart from the Read etc. rights it already has (but don’t give Full Control). Remember to do this again every time you may replace the site folder (btw to not lose your previous uploads, neither those access rights settings, you can “cut” that folder and paste it on your server desktop, then paste it back after you’ve replaced the wordpress folder contents with say some new version of the site code, deleting first the new wp-content\uploads).
  2. Either repeat the same process as above for folder c:\windows\temp (or whatever system temporary folder you’ve set at advanced system properties / environment variables dialog), or to be more secure in case some PHP bug gets exploited, you can create a separate temporary folder specifically for all PHP apps or even specifically for your wordpress site and using PHP Manager plugin for IIS (can get that via WebPI) you can select to manage all settings for the whole server or for your site respectively. Then you select one-by-one the settings that say c:\windows\temp\… (or any ones that say /tmp to be safe) and change them to use the temp folder you’ve created. Make sure you use double quotes for those string settings, since the PHP Manager plugin doesn’t seem to add them itself (not sure if not having them would cause problems to PHP when trying to read php.ini file).
Categories: Posts Tags: , , , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: