Php/iis: failed to open stream: Permission denied

fopeniisphpwindows

I am trying to do this:

$fh = fopen("req2" , 'w')

and I get:

Warning: fopen(D:\inetpub\wwwroot\req2) [function.fopen]: failed to
open stream: Permission denied in D:\inetpub\wwwroot\test.php on line
44 can't open file

I gave "Full Control" permissions to IIS in the wwwroot directory. I had also tried the absolute path: $_SERVER['DOCUMENT_ROOT']."\\req2"

but i still get the same error. I am running IIS 7 on Windows 7.

Best Solution

In Windows, you need to give user, IUSR the permission.