The first bump I got from encountering the WordPress rake on IIS: a problem with displaying pictures. When you upload an image to the ‘media’ of WordPress, it doesn’t display and gives an error:
HTTP Error 500.50 – URL Rewrite Module Error
After searching here and there it became clear that it is a problem with the rights to the folders. The permissions in IIS are very … how shall I put it softly – unusually in comparison with crystal clear system CHMOD *nux servers.
IIS permissions are set via folder properties -> “security”. Everyone who sits on the windows used to watch this tab, to change something in it in the daily “local” work there is rarely a need. And so – it occurred to me that this system is actually the Windows analogue of CHMOD, and for the web server is extremely important to configure it correctly.
What the problem is:
But back to our bug. It turns out that PHP loads your picture first into a temporary folder, which by default is
C:\Windows\Temp
and then it moves it to the webserver directory
/blog/wp-content/uploads/…
There is a problem with images because server (IIS) doesn’t have proper permissions for temporary folder
C:\Windows\Temp” directory
and when a file is uploaded there and then PHP moves it around, the file inherits “no rights”. As a result, the file in
/blog/wp-content/uploads/.
gives an error 500 when it is accessed.
Solution:
Set the correct permissions on the winds temporary files folder:
Windows\Temp
to do it, click on folder -> “security” and set permissions:
Allow modify (“modify”) for IUSR users and read (“read”) {server_name}\IIS_IUSRS
I would recommend separating the PHP temporary files from the system temporary files altogether. To do this, the php settings file, it would be approximately here:
C:\Program Files (x86)\PHP\vX.X\php.ini
and set there the value of
upload_tmp_dir
by default it will most likely be
C:Windows\Temp
In this case we create a new folder and set its path, for example
C:\temp_PHP
and set permissions to the two users mentioned above