If you’ve had the misfortune of needing to develop an EE solution on a Windows IIS setup… my condolences. The biggest problem you’ll run into is figuring out the correct file permissions (or rather how to figure them out), and unless you were lucky (as I was) to have remote access to the Windows box in question, working with a host unfamiliar with EE or similar CMS’s will be a delight. Good luck.
The problem:
I spent a lot of time scratching my head as to why EE’s built-in File Upload utility would allow me to upload files, overwrite, rename and generally do everything it’s supposed to do, but wonderful extensions like Mark Huot’s File and nGen’s File Field would either make my Publish/Edit forms return a server error (500) or would return the 500 error upon submission/update.
Again, having (remote) access to the IIS box is wonderfully helpful, because local browser error reporting is much more detailed. It’ll demonstrate with which script the error is occurring rather than just spitting out a 500 error. But because I know not everyone has that sort of access, I thought I’d share the cause of and solution to my situation.
The diagnosis:
The error I was getting was in regards to the temporary write directory of these extensions, which by default make use of whatever default variable is set in your PHP configuration (php.ini). This temporary upload directory variable (called “upload_tmp_dir”) and, at least on Windows boxes, must be a child of the “base” directory, stored in a variable called “open_basedir”. You can find the value of these variables by selecting Admin -> Utilities -> PHP Info from the CP.
The problem? My “open_basedir” was C:\publicsite\ but the “upload_temp_dir” was, by default setup, C:\Windows\Temp\ and because Windows\Temp is not a child/subfolder of C:\publicsite\, I was getting an error.
The solution (to enabling file upload extensions – or any extension which could make use of the default temp upload directory):
• Create a new subfolder to use as a temp upload directory somewhere beneath \publicsite\ (replace with your website root folder name) and make sure the permissions are such that PHP can write to it. I’ve called my folder “upload_temp”.
• Edit php.ini and find the “upload_temp_dir” variable, and change the path to the path of the folder you just created (C:\publicsite\upload_temp). You will not need to change the “open_basedir” variable. Save.
• Reboot IIS, and check the PHP Info again from the CP to make sure the variable has been changed.
• Enable whichever extensions were driving you insane and enjoy!