WordPress Permission Problems on IIS

WordPress Permission Problems on IIS

While I would never recommend running WordPress on a Windows box unless you have to (having done this for several years and the performance was just never on par with a Linux equivalent), if you must then you may encounter permission issues kicking up errors like these:

  • Destination directory for file streaming does not exist or is not writable.
  • Missing a temporary folder

Use Recommend IIS Permissions

Historically IIS sites used the IUSR account for anonymous authentication and so permissions we’re granted to this.  Best practice now however is to run each site under its Application Pool Identify.

  1. Ensure your site has its own Application Pool
  2. Right Click the Application Pool and go to Advanced Settings > Processing Model > Application Pool Identity
  3. On your site, double click > Authentication > Anonymous Authentication > Application Pool Identity (not IUSR)
  4. Next in explorer, browse to the sites folders and grant read/write/modify permissions using IIS AppPool\MyAppPoolName

WordPress Temporary Folder

define(‘WP_TEMP_DIR’,dirname(_FILE_). ‘wp-content/temp/’);

After the lines that define ( ABSPATH: define(‘ABSPATH’, dirname(__FILE__) . ‘/’)) and then pull in the settings (require_once(ABSPATH . ‘wp-settings.php’);), paste the following if you want to specify your own temporary folder.  For example the following line tells WordPress to use a folder within wp-content:

define('WP_TEMP_DIR',dirname(__FILE__). 'wp-content/temp/');

Next in explorer, browse to the temporary folder and ensure you have granteded read/write/modify permissions using IIS AppPool\MyAppPoolName

Windows Temporary Folder

Now you may still receive an error when uploading even after the above has been done.  This can be because PHP uses its own temporary folder while the file is being streamed to the server before moving it to the WordPress temporary folder to work on it.

Whatever the folder is (see below), you need to ensure that the same Application Pool group has read/write/modify access to it, for example: IIS AppPool\MyAppPoolName

If you want to specify the folder PHP uses, you need to update this line in the php.ini file (typically found in C:\Windows\Program FIles\PHP or C:\Windows\Program Files (x86)\PHP):

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir = C:\Windows\Temp

 

 

Bob McKay

About Bob McKay

Bob McKay works at Perfect Image, is a father, programmer and a self confessed techie-geek type.

Disclosure Policy

Bob on Google+

2 comments on «WordPress Permission Problems on IIS»

  1. Richard May says:

    Next in explorer, browse to the sites folders and grant read/write/modify permissions using IIS.
    Which folder do you mean specifically

    1. Bob McKay says:

      I believe at the minimum, the wp-content folder and subfolders need read/write/modify, for the others you may be able to get away with read only.

Leave a Reply

Your email address will not be published. Required fields are marked *

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