I seem to have a permissions problem with my PHP database & file upload scripts running on IIS 6. I wonder if it is something to do with Windows/IIS config or my PHP config. I will attempt to try various platform setups on the system and other ones to try and debug the cause but in the meantime, I could use your insights as to what might be the bug here. Below I give details on my platform and the exact permissions issues I'm having.
I wonder if anyone else has done similar projects working with PHP on Windows and IIS. I'm using PHP 4.3.3 ISAPI module for IIS 6 on Windows 2003 to do back-end scripting and connecting to MS Access 2002 databases via ODBC.
We also use FrontPage 2002 as the web editor & for web user login management via the Server Permissions feature which we use for user verification & identification. (I would have opted for other alternatives for user management but this was not my call for the platform, but the PHP scripting I did choose.)
I have built a web app that works for info update once the user logs in and also offers file uploading to the server. Login is through password-protected directory using FrontPage-IIS HTTP authentication. The web app only uses the user ID extracted after user logs in to determine where to send info to database and where to store uploaded files. So the login/permissions is separate & just handled by the server. The current setup of the server allows for login with system/server accounts as well as accounts made by FrontPage. (or is that how IIS HTTP authentication works anyways?)
What I encountered is that my database scripts & file upload scripts don't seem to work due to permissions, with one caveat explained in a sec. The db update queries go unsuccessful, db results queries show blank page, file uploads don't go through. At first this seems the issue is obvious but this is interesting:
1) I tested the file upload script on a Unix system and it worked ok. So maybe I need to set the server permissions right on Windows/IIS. So far the files go under a central directory that houses subfolders for each user's uploads. I set the central or parent directory permission writeable for IUSR_machine, System account is the same. That should make the subfolders the same right? I'll double check tomorrow though. Still no luck so far.
2) Since I use MS Access & ODBC, there is no Unix equivalent for me to test (right?) so I couldn't do much here. ODBC doesn't actually require permissions does it?
But the MOST INTERESTING THING OCCURRED in my testing on the server: when I login with an administrator account on the login website, all the scripts (db & uploads) work perfectly. Why is that? After all PHP runs on IUSR_machine or some system account right? Here it seems somehow the admin login affects the scripts, which don't use the account for permission to do stuff. It's like the PHP scripts are then binded to the admin account or something. Or am I just ignorant of some obvious feature of IIS/PHP? I tested with other accounts like the FrontPage web accounts originally intended to be used, a Windows User account, and a Windows Power User account. All these accounts yield the same problem. Putting the db result query on a page that doesn't require login also doesn't work.
I'm also going to try and test on a Windows 2000/IIS 5 machine with PHP and PHP as CGI to see if there's any difference there.
I hope this issue can be fixed as I hate to resort to switching to ASP or FrontPage's do-it-all-database-uploads-features 'cause ADO/OLE DB is too complex for me to learn in a short time period and FrontPage isn't really reliable & customizable, with extra crap code.