Jump to content

opendir on mapped network drive


parris.varney@ontech.com

Recommended Posts

Hello all,

 

I've been at this road block for far too long: I can't seem to open a directory not on my local file system using PHP's opendir() function.  I definitely have access to this directory, it's mapped as my "O:" drive and I'm not prompted for a password when I open it via Windows.  I've been digging through the internet looking for anything to help.

 

Here's the error (well warning) message:

Warning: opendir(\\Ontech\Data) [function.opendir]: failed to open dir: Invalid argument in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\scrips\dataLoad.php on line 19

 

Here's the code:

<?php
        error_reporting(E_ALL);
        ini_set('display_errors', '1');

$fileLocation = "\\\\Ontech\\Data";
$dirHanlde = opendir($fileLocation);

while( $file = readdir($dirHanlde) )
{
	echo $file . '<br>';
}
?>

 

Note that for $fileLocation I've tried

$fileLocation = "O:\\Data\\";

$fileLocation = "file:///OnTech/Data/";

$fileLocation = "file://OnTech/Data/";

$fileLocation = "file://OnTech/Data";

$fileLocation = "\\\\Ontech\\Data\\";

 

The remote computer is set to allow access from my account, my computer and (for now) anonymous users.  Also, I've tried to set my Apache service to use every login I can think of.

 

Any help is appreciated, if even a link so I can "read the flippin' manual".

 

Thanks in advance,

Parris

Link to comment
https://forums.phpfreaks.com/topic/81751-opendir-on-mapped-network-drive/
Share on other sites

Yea...

 

I've found a reference that sounds promising, but I'm not entirely familiar with what they're talking about.  This might be my

 

problem:SMBsrvr doesn't allow nullSession...

but why WEBsrvr tries to connect using nullSession ?

because Apache is running as LocalSystem

 

The article is at http://bugs.php.net/bug.php?id=25805

 

Are you familiar with this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.