Php / iis: Could not 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 open stream: permission denied in D: \ inetpub \ wwwroot \ test.php on line 44 cannot open file

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

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

+6
source share
5 answers

This worked for me:

Right folder -> Properties -> Security -> Modify -> allow full access -> apply -> do it for everyone or just the right user

+1
source

In addition, if you encounter this loaded code, make sure it is "unlocked" to run locally.

You must also disable file encryption.

0
source

Got it today in Windows 10 after I opened access to the wwwroot folder. Worked before. I had to disable sharing and reapply the iis_iusr permissions.

0
source

On Windows, you need to give the iUSR user permission.

0
source

Source: https://habr.com/ru/post/908037/


All Articles