0

I am trying to make a folder with mkdir, it will work as expected on a local drive, but it will fail with No such file or directory if I use a mapped network drive. I ran into this a year or so ago, and solved it with some net use trickery, but can't remember what it was.

An example command: mkdir("Z:\\Mydir\\Subdir\\", 0777, true), this fails. But mkdir("C:\\Mydir\\Subdir\\", 0777, true) is successful.The permissions on the network drive are wide open for testing, and any user can create directories.

If I create a symlink for C:\Mydir\ to Z:\Mydir\ and use mkdir("C:\\Mydir\\Subdir\\", 0777, true) it instead throws an Invalid arguments exception.

Why does phps mkdir not seem to function correctly on mapped network drives?

Douglas Gaskell
  • 6,562
  • 6
  • 55
  • 103
  • 2
    Why do you believe that the local web server has permissions to create a directory on the network drive? – Ignacio Vazquez-Abrams Jun 23 '18 at 08:30
  • @IgnacioVazquez-Abrams Because the permissions are set to allow Everyone to have full control. Any user can do what they please with the share. Side question, does mounting the drive not permit, say the user the web server is using, to access that mount as the user it was authed with (`nfs use` with password and user)? – Douglas Gaskell Jun 23 '18 at 08:32
  • @IgnacioVazquez-Abrams your prompt was enough for me to find the answer. Which was to map the drive under SYSTEM. Answer here: https://stackoverflow.com/questions/182750/map-a-network-drive-to-be-used-by-a-service – Douglas Gaskell Jun 23 '18 at 08:47

0 Answers0