Jump to content

Allowing PHP to write to C:/WINDOWS/Temp


Recommended Posts

Hi,

I'm pretty new with PHP, and I'm using vista with IIS 7.0, php 5.1 and MySQL.

 

I'm just trying to get a php script to work, and it's pointed to be able to write session data in my C:/WINDOWS/Temp directory.

 

I know this is simple, but I can't figure out how to allow access to it.  When I run the script it exits and gives me:

 

Warning: Unknown: open(C:\WINDOWS\Temp\sess_850474574d833eefdfe93eebb21dabba, O_RDWR) failed: Permission denied (13) in Unknown on line 0

 

So it's not allowed to write to the Temp directory... how do I let that happen?

 

Thanks for any help!!

Link to comment
Share on other sites

  • 2 weeks later...

First off, make sure that folder exists.  If so, then continue with the next stuff.

 

 

You will need to give what ever user PHP is being ran as (probably the user under which IIS is running) read/write permissions to C:\Windows\Temp.

 

 

To do it through the GUI, just navigate into the Windows folder, right click on the Temp folder, hit properties, go to the security tab, then I'm sure you can figure it out from there.

 

 

To do it through the command line, you could do something like:

 

(If it's an older OS, you would have to use cacls, not icacls.  Note: they are not interchangeable!)

 

icacls "C:\Windows\Temp" /T /grant "User PHP Runs As":RWMD

 

That would grant read/write/modify/delete permissions to "User PHP Runs As" to C:\Windows\Temp and everything below it.

 

Depending on the existing settings, you might also need to tweak inheritance settings though, so I would probably just go the GUI route.

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.