IIS WordPress images 500 error
If you are here you probably are having the dreaded “broken images” problem while running WordPress under IIS.
You may have found this issue by looking at the IIS logfiles for your site and seeing 500 errors logged when it’s supposed to be pushing out images.
I will save you a lot of time.
This is all about fixing permissions so that images/media/files uploaded via WordPress will properly render.
This is the fix for the infamous “500” error that is thrown when your server has wrong file permissions and the visual result is all the images you uploaded are “broken images” and won’t display. Also called HTTP Error 500.50 – URL Rewrite Module Error when you have Detailed errors on.
- Don’t sweat it, I will save you HOURS of time on this one. Thanks to the article I found here after HOURS of tracking this issue down, this problem is caused because PHP first uploads the document to a temporary directory (by default C:\Windows\Temp), and then moves it from that directory to the actual /blog/wp-content/uploads/ subdirectory. What happens is that because IIS does not have any permissions to your “C:\Windows\Temp” directory, when the file is uploaded there, then moved by PHP, the file inherits NO permissions. So when IIS trys to serve out that file from your /blog/wp-content/uploads/subdirectory it throws a 500 error and that is actually a permissions error.
- The solution: on the Windows\Temp folder, grant “modify” permissions to both IUSR and {servername}\IIS_IUSRS user accounts.
- Now when you upload files via PHP and PHP moves them to the correct directory, the files will have the correct permissions and can be accessed.
- Important note #1: If you already have uploaded files and are getting the dreaded broken images issue, go to the /blog/wp-content/uploads/directory and replace/update the permissions to add access for both user accounts noted above. That will solve that issue.
- Important note #2: as with any change off the defaults for Windows, you do this AT YOUR OWN RISK. It’s up to you if you want to grant the Windows\Temp directory permissions for those two accounts. If you don’t PHP won’t be able to upload without the 500 issue (unless you move the PHP temp folder elsewhere and grant those accounts access to the other folder). Do these changes at your own risk… I cannot and won’t take any responsiblity for your systems. Please know what you are doing.
UPDATE: 04/29/2011: One reader commented to me that he is concerned about changing security permissions on the Windows TEMP directory, and he noted that you can also edit the php.ini file and change the location of the “upload_tmp_dir” variable and point it to another location. It’s up to you how you want to do this, as long as you have the right permissions mentioned above, your WP images and future uploads will work fine.
Pingback: Afbeeldingen in WordPress | Johan Eikelenboom
Thanks a million, saved me a major headache!
Same here, thanks for this post – saved my skin. You should post this as a Q&A under stackoverflow.com or something so others can refer to this as well
Genius! Thanks so much I was trying everything to get this working – you’re a super star 🙂
Thank you so much I have had an issue uploading images in WordPress and your solution worked for me. I am in your debt 🙂
Thank you SOOOO MUCH this saved me so much time, I found this right away and it worked immediately
Pingback: How To: Friendly Wordpress URLs to your blog posts on IIS | The .CQ blog
Pingback: WordPress Installation on IIS with PHP. Pretty URL and Error 404 and 500 | henrywrites
Your a lifesaver. I have been tearing my hair out with this issue and for a bald man that’s not a good thing 🙂
Cheers,
James
Pingback: Images being displayed on your WordPress Blog? |
Step #4 is the critical life-saver step that most other links don’t mention. You are awesome!!
WOW. MAJOR headache solved. I never thought I was going to figure this one out.
I can not thank you enough for this. I granted IIS_IUSRS / IUSR access to my WP Folder AND the temp and it fixed all my issues. THANK YOU!
Just IIS_IUSRS with read permissions was enough for me.
THANK YOU! This saved me some major headaches. As Conor above me said, you only need to add IIS_IUSRS to the directory, as both IUSR and your ApplicationPoolIdenty’s are part of that user group.
Thanks so much, that was very helpful and saved me alot of time.
I hope that karma gives back all the time you’ve saved people as extra years on your life for you.
Thanks a lot ! You saved me LOADS of time!
This is fantastic and as of WordPress 4.8 on IIS 8.5 is still a valid issue (July 2017).
Amazing. Thank you for posting this. Saved me some time. It’s still an issue with wordpress 4.8 behind IIS 10.
thank you, i was aware of this fix sort of but only with the {servername}\IIS_IUSRS user but adding the IUSR user fixed it for me
Thanks very much, you save my time
Amazing post !! that is really helpful content.
Thanks
This is pretty old, but I’m thankful for stumbling upon it and it just save my life a ton.. Genius
Thanks for this post. Saved a client from moving away!
You, sir, are a gentleman and a scholar. Thank you for sharing this – saved me hours of work.
THANK YOU Spent HOURS trying to figure out knew it was permissions but was not sure
Thanks for the post, still valid in 2018!
Definately worth checking the part 2 of your post , update the WordPress upload folders, if you’ve loaded images before checking these file permissions.
This is awesome. Worked for me. THANK YOU
I’m not a big fan of WordPress, but my users love it so they get what they want. Had several sites have this happen (most of them comic blogs) and was pulling my hair out and grinding my teeth wondering why it would load the image.
One test I did was copy one of the blogs and build a new site in IIS and the permalinks were down, but direct image URLs worked. That made me think there was a problem with my web.config so spent too long on trying to find a problem there too.
You saved many hours of work, thank you VERY MUCH!!
Thanks for this man
Can’t thank you more! Made my day…
Finally!!!!!!, thank you so much, after dozens of articles read this is the only one with the right solution. Thank you again.
Thanks, you rock… Spent hours trying to figure this out until I found your post… BOOM!
Thank you for taking the time to write this up!