Reputation: 3
I have this web system in PHP (5.6) and is running in IIS 8.5 Windows Server 2012 R2. What I wanted to do is list all the files in a directory. The directory that I'm reading is a mapped network drive of a shared folder of another server (Y:\sharedfolder). When I execute command dir of the network drive, it is not seen by the php code
I have searched here in site and saw a lot of possible solutions but nothing work on my end. I'm not sure I'm doing them correctly. So I'll share my current settings here.
When I ran whoami in CLI, I get "pc_name\administrator". when I execute it in code, I get "iis apppool\cs2".
The mapped network drive (Y:\sharedfolder) is shared to the following:
My IIS Settings are the following:
[Authentication]
[Application Pools]
[Fast CGI Settings]
[Sites: CS2]
These are all my settings yet I still couldn't access the Mapped network drive. Is there a missing or incorrect setting in my IIS?
Upvotes: 0
Views: 1418
Reputation: 3494
Not sure if it works fine with mapped drive,IIS and PHP. But it is recommended to use UNC path instead.
When you run whoami, your application exectued it as your login user. However, when you host web app in IIS. The app run under application pool identity and access file via anonymous user.
If your shared folder server and IIS server are in the same domain. Then you could try to set application pool identity to a domain account who has enough permission to access the folder. Then please go to anonymous authentication and edit it to use Application pool idenity.
If you your shared folder server and IIS server are two separate workstation. Then you may need to create a user with same username and password. Then Grant the user read/write permission to access the UNC path. Finally you only have to set both anonymous user and application pool identity to this user.
Upvotes: 1