0

I have three windows servers, one is a Domain Controller, one hosts laravel via IIS and the other is a windows server with a shared network folder for storage. Everytime I try to access the folder on the shared drive using the following:

scandir('\\servername\foldername');

I get the following error

scandir(\servername\foldername,\servername\foldername): Access is denied. (code: 5)

This is obviously a permissions error as the access to server is limited to only accounts in the DC's AD where as the laravel application is executing using the local IIS user. Can someone please help me with what I should try to do?

Thanks!

aslade
  • 23
  • 1
  • 1
  • 5
  • 1
    I had this same problem starting with php! Things like scandir and fopen want an absolute *local* path, not one with a protocol or anything. If you are mapping the drive locally, this is the path it wants. – Tyler Glen Sep 18 '20 at 01:28

1 Answers1

0

You should modify the IIS application pool identity to network service account and then modify the shared folder permission to let network service account to access.

Details about how to modify application pool, you could refer to this article.

More details about how to set the shared folder permission, you could refer to this answer.

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65