Jump to content

Permission Denied when renaming file


MIDIJunkie

Recommended Posts

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!

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.