Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php/iis: failed to open stream: Permission denied

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.

like image 855
hoshiKuzu Avatar asked Feb 09 '12 12:02

hoshiKuzu


2 Answers

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

like image 153
Sohail Ahmed Avatar answered Oct 14 '22 19:10

Sohail Ahmed


This worked for me:

Right click folder --> Properties --> Security --> Edit --> allow Full Control --> apply --> do this for all, or just the correct user

like image 2
xinthose Avatar answered Oct 14 '22 18:10

xinthose