I have a hyper-v server with 3 instances running under it, testing, production, and files. The production user can access the mounted files directory with the following permissions; 'read & execute', 'list folder contents', and 'read'. The testing server's user has the same permissions but can't read them.

The error in my PHP logs is

[09-Mar-2012 06:40:07] PHP Warning: file_get_contents(\\Web\Data\files\thumbs\img123.png) >[function.file-get-contents]: failed to open >stream: Permission denied in C:\inetpub\wwwroot\testing\test.php on line 2

My PHP script is

$jpg = file_get_contents('\\\Web\Data\files\thumbs\img123.png');

Are there other settings I'm missing? The PHPInfo says the username is 'test1$'; could the IIS be trying to access the files as a different user?



Take a look at the settings for:

  • The Application Pool Account - this might be set to run as a different user

  • The Authentication -> Anonymous -> Settings (if you're using anonymous authentication)

  • Authentication settings in general if you're expecting the user to authenticate and this to then happen on behalf of the user.

You mentioned "mounting" which could indicate that impersonation is being attempted and failing (which would cause the App Pool account's network identity to be used; that'll probably work out to being Test1$/the computer account, in most cases).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.