MIDIJunkie Posted January 30, 2013 Share Posted January 30, 2013 Hello! I'm running: Win Server 2008 r2 SP1 Running IIS PHP 5.2.17 MySQL 5.1.56 Server managed by Plesk v. 11.0.9 I just moved my site from one server to another recently. I have a vendor that FTPs a CSV file to the "/Inetpub/vhosts/domain.com/httpdocs/directory" folder periodically. From there, I have a script that reads that directory, processes the file (via LOAD DATA LOCAL INFILE, so no "fopen" to "fclose", although I do use "opendir()", but make sure I follow it with "closedir()" before I proceed), and then renames the file to mark it as "processed". However, I have found that the script doesn't like the rename function, and I can't seem to figure out why: Warning: rename(/Inetpub/vhosts/domain.com/httpdocs/Directory/file.csv,/Inetpub/vhosts/domain.com/httpdocs/directory/file.csv) [function.rename]: Permission denied in C:\Inetpub\vhosts\domain.com\httpdocs\scripts\processing.php on line 30 Since it's a Windows server, CHMOD isn't an option. Can anyone come up with any suggestions as to how I can get this function to work? Thanks for any suggestions! Quote Link to comment Share on other sites More sharing options...
kicken Posted January 30, 2013 Share Posted January 30, 2013 For a windows server, the equivalent to chmod would be the Security tab in the file's Properties dialog. Go there any make sure the user the script runs as has the proper permissions to modify the file (and possibly the directory it is in). Quote Link to comment Share on other sites More sharing options...
MIDIJunkie Posted January 30, 2013 Author Share Posted January 30, 2013 Hi, kicken, thanks for the suggestion- Just to get a little more info, please - how can I check what user is running the PHP script when I load the script in a browser? Quote Link to comment Share on other sites More sharing options...
kicken Posted January 30, 2013 Share Posted January 30, 2013 Based on the Inetpub in your path, I am assuming you are using IIS as your server. In that case the user would be defined by the application pool that the site is using. You should be able to find it in the IIS config somewhere, exactly where depends on what version of IIS you are using. Under a default setup the user is usually called IUSR_machineName where machineName is the name of the computer. A quick hack would be to just grant 'Full Control' to the pseudo-user Everyone (roughly equivalent to chmod 777 in a linux environment). Quote Link to comment Share on other sites More sharing options...
MIDIJunkie Posted January 31, 2013 Author Share Posted January 31, 2013 Thanks for the suggestions, kicken! It seemed that IIS was running as a virtual user "DefaulAppPool". I tried giving that account full control over the directory, but had no luck. I ended up giving "everyone" full control of the folder (not ideal, I know, but I'll keep poking around until I get something a little more secure going. That worked perfectly, but, like I said, I want to make it a bit more secure than that. Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.