Jump to content

[SOLVED] Referencing Windows Network Drive with PHP


mtorbin

Recommended Posts

Hey folks,

 

I'm primarily a Mac/Unix developer so working in the Windows world is a bit foreign to me.  I have a network drive that I want to connect located at:

 

\\myDrive\myDirectory\

 

When I type that into an address bar in Windows, I connect right away.  I can ping the drive with no problems.  However, when I type something like the following:

 

$dir1 = '\\\\myDrive\myDirectory\\';
opendir($dir1);

 

I get a "failed to open dir: Invalid argument in ...." error.  What am I missing?  I've tried researching this online but I haven't found anything that would suggest a solution.  Is this an IIS issue?  Is this a PHP issue?  Any help would be much appreciated.

 

Thanks,

 

- MT

 

you are probably running PHP as an Apache service, which means the script is running as a SYSTEM account with no network privileges

 

Thanks for the quick response.  Where would I look to correct this issue?  The script ultimately needs to run as a "cron job" (not sure if the Windows term is the same) from the server where it currently resides.

 

- MT

while you are testing, use PHP from the command line:

php -f /path/to/script.php

 

should work fine that way

 

Cool, I just tried that it it works.  However, if I'm running it from a terminal (i.e. command window) via RDP, then I'm running it under my account (not the SYSTEM account) which has privileges and thus it works, right?  I've already tested it on a local server and I know it works.  My only concern at this point is making the connection between the live server and the script server.

 

- MT

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.