Link to home
Start Free TrialLog in
Avatar of THPWebTeam
THPWebTeam

asked on

PHP on IIS FOPEN permission denied

I'm trying to either write or create a file, but I keep getting a permission denied error.

failed to open stream: Permission denied [file]

I did the following already:

In the php.ini file :
allow_url_fopen = on
allow_url_include = on
file_uploads = on

On the server:
IIS_IUSR has FULL CONTROL permission which allows:
traverse folder/execute file
list folder/read data
read attribute
read extended attributes
create files/write data
create folders/append data
write attributes
write extended attributes
delete subfolder and files
delete
read permissions
change permissions
take ownership

In my code I've tried:
$file = fopen( $GLOBAL_FILEPATH, 'wb' );
$file = fopen( $GLOBAL_FILEPATH, 'w' );
$file = fopen( $GLOBAL_FILEPATH, 'w+' );

I can read from the file, so that ensures that my directory path is correct.

No luck.  Any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Springy555
Springy555
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of James Murrell
James Murrell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of THPWebTeam
THPWebTeam

ASKER

Already did that previously.  No luck.
Sorry I mean, I already did what cs97jim3 suggested.  I will check on what springy555 suggested.  Thanks!
Double checked, already done.  Anything else?
Try giving permissions to IIS_WPG local security group as well
No such group on an IIS7 server. I gave 'everyone' full access.  And this worked!

'Everyone' is a system group that includes all accounts.

I hate to give everyone full access, is it possible to pinpoint which account it is?
If you remove the everyone account, check the security event log for any audit failures.

The IIS_WPG group equivalent in IS7 is IIS_IUSRS.  Maybe try adding that account as well.
>>If you remove the everyone account, check the security event log for any audit failures.
What would an audit failure do?

Yes, in my OP, I mentioned that IIS_IUSRS was given full control allowing it do everything.
Any failed logon attempts should be caught by the security log.  You can then see which account failed, then give that account the correct permissions.
Thanks to both for your contributions!