1
votes

After a few weeks trying to access content in virtual folder my question:

I have two webservers for load balancing. I have a storage-server for uploaded files. I created a domain-user for the storage with the right privileges. In my PHP-webapp in IIS6 I created a virtual directory pointing to the storage by a UNC-path with 'Connect as' the privileged user. The virtual directory is named 'upload2'.

From my php-script i'am trying to acces the upload2-folder (for reading/writing) with scandir or tried to write a file with fopen. In IIS i can browse/view the contents op the virtual folder. But php says

'Warning: scandir(upload2,upload2) [function.scandir]: The system cannot find the file specified. (code: 2) in E:\inetpub\wwwroot\pvmonitor\test2.php on line 25 Warning: scandir(upload2) [function.scandir]: failed to open dir: No such file or directory in E:\inetpub\wwwroot\pvmonitor\test2.php on line 25

by executing the script:

$filename='upload2';
$dir    = $filename;
$files1 = scandir($dir);
print_r($files1);

how do i point php to this virtual folder?

1
scandir('upload2'); may only work only for a subfolder named 'upload2' for your case, try scandir('\\storageServerName\upload2') provided that 'upload2' is the name of the share and permissions are okLuis Siquot

1 Answers

2
votes

PHP cannot access a virtual dir because it is virtual, it is only used by the website, you need to read/write the actual physical path that the vdir points to.