2

(Assuming the network folders/permissions are correctly set up and working in Windows, and a 'default' PHP setup...)

Is it possible to use UNC network paths [like \\ServerName\Folder\file.txt] in PHP's functions like file_get_contents(), fopen(), etc?

And/or, what special cases allow/disallow this?

anonymous coward
  • 12,594
  • 13
  • 55
  • 97

3 Answers3

1

UNC paths should "WORK" if permissions are set properly. And the network folders are allowed to be accessed by apache user, then there won't be any problem.

In these scenarios open_basedir creates problems, just keep an eye on that

Ish
  • 28,486
  • 11
  • 60
  • 77
0

PHP absolutely permits UNC paths. You may have issues regarding which user is actually executing the code. If it is Apache running as a service then the user will be whatever user is listed in the entry for the windows service. if it is IIS then the user is typically IUSR_machineName. If it is as a console then it is the currently executing user.

Ben Reisner
  • 662
  • 6
  • 16
  • In reference to Alex's statement about mapped network drives I do not recomment this. Mapped network drives are not available to PHP applications that are running inside of a web server running as a service. One application I have that requires use of mapped network drives is forced to run the web server as a console application (apache is in the startup and the server must always be logged in) – Ben Reisner Jul 07 '09 at 18:23
0

No, unc path will not work with command, like @exec for example.

If you have a php script inside an unc path that calls @exec, it will failed, even if the @exec point to an executable in your c:\ directory.

Jason
  • 2,503
  • 3
  • 38
  • 46