praveenjayapal
praveenjayapal

Reputation: 38529

Access shared drive using OPENDIR

I want to display all the drives in my system through PHP, So i used opendir. Here a problem i had already mapped a drive in the name of Z: this drive not showing while we try to displaying the drives in browser.

Basically i am having c: drive and additionally i have mapped the Z: drive from network connection. Please help me how to show both the drives in browser

Upvotes: 0

Views: 1816

Answers (1)

Sander Versluys
Sander Versluys

Reputation: 74447

The default SYSTEM User under windows will not be able to access mapped network drives. Services run under this user by default, like Apache.

Mapped network drives are mounted for a specific user and won't work for other users.

Tips:

  1. Instead of using the drive letter use the UNC path. (example: '\\server\share instead' of 'g:\')
  2. Mapped drive is mapped for some specific user, while service is running in another context and is not aware of this mapping. There is a privilege called "Log on as a service". The user account you specify for service should have this privilege. Use secpol.msc to grant it.
  3. Run the server from the local user to which the network drive is mapped, instead of running it as a system service. Use services.msc and change the user under the Logon tab.

Always do tip 1. Choose between tip 2 or 3.

Upvotes: 2

Related Questions