php - Read file on a network drive -
i'm running xampp on windows server ; apache running service local account. on server, network share mounted x: specific credentials.
i want access files located on x: , run following code
<?php echo shell_exec("whoami"); fopen('x:\\text.txt',"r"); ?>
and
theservername\thelocaluser warning: fopen(x:\text.txt) [function.fopen]: failed open stream: no such file or directory
i tried run apache, not service directly launching httpd.exe ... , code worked.
i can't see causes difference between service , application , how make works.
you're not able using drive letter, network mapped drives single user , can't used services (even if mount user).
what can instead use unc path directly, example:
fopen('\\\\server\\share\\text.txt', 'r');
note, however, there few issues php's filesystem access unc paths. 1 example bug filed imagettftext, there issues file_exists
, is_writeable
. haven't reported latter because can see long-outstanding bug imagettftext
, what's point.
Comments
Post a Comment