[RESOLVED] WAMP system(net use....
Results 1 to 5 of 5

Thread: [RESOLVED] WAMP system(net use....

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    472

    resolved [RESOLVED] WAMP system(net use....

    I am trying to connect to some Windows directories using system(net use...). I works fine on my local machine where I have installed PHP, MySql, Apache... Though, I need to move it to a Windows 8 Server using WAMP. When I try running the script from there it's like it doesn't recognize the system() call and I get the following error:

    Code:
    Warning: opendir(V:/today/,V:/today/) [<a href='function.opendir'>function.opendir</a>]: The system cannot find the path specified. (code: 3) in C:\workspace\www\cameracatcher\camera.php on line 205
    Here is my actual call:
    PHP Code:
    $testWH = array(=> array('WH' => 'ST. Louis''IP' => '100.100.2.200''DRIVE' => 'V'),
                    
    => array('WH' => 'Visalia''IP' => '100.100.3.200''DRIVE' => 'U')
                    );


    $camCheck = array();
    $doCamCheck = array();
    $imgs = array();
    $deadCamCheck = array();
    $docheck = array();
    $countArray 0;
    $countImgs 0;

    //------------------------
    //loop through warehouse to check
    //------------------------
    foreach($testWH as $w=>$h){
    //------------------------
    //Map the drive 
    //------------------------
    system('net use '.$h['DRIVE'].': \\\\'.$h['IP'].'\\'.$folder.'\ '.$pass.' /user:'.$user.'/persistent:no'); 

    //------------------------
    //call func to read thru dir's
    //------------------------
    $doCamCheck openMyDir($h['DRIVE'].":/today/"$camCheck$imgs);
    .
    .

    I've tried going into services.msc and changed the Apache user to an admin user instead of the local login user. I also set safe_mode_exec_dir = OFF.

    Could this be an issue b/c I am on Windows Server 8 or something w/ the WAMP install?

    I appreciate any feedback.
    Bob Lob Law

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,414
    Looks to me like the most likely culprit is a failure of the "net use" command. Can you somehow verify that "V:" is mapped and accessible before you assign $doCamCheck?
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    472
    I have the network drives mapped and I can access the directories fine browsing on the Windows Server 8 box. Then, on my local machine (windows 7.. manual install of PHP) on the same network w/ those mapped drives I can access them w/ the exact script. It seems when I try to run it via WAMP on Windows Server 8 is when it fails. I tried: services.msc > Log On and switched back to Local System and checked "Allow Service to interact with desktop". No luck w/ that either. Is there something I can look at in phpinfo() that would tell me anything about "net use"?
    Bob Lob Law

  4. #4
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    8,414
    I don't know about net use in phpinfo(). I kind of doubt it, but I suppose you could try.

    Have you tried adding the return_var param to your system call to see what results from it?

    PHP Code:
    //------------------------ 
    //Map the drive  
    //------------------------ 
    system('net use '.$h['DRIVE'].': \\\\'.$h['IP'].'\\'.$folder.'\ '.$pass.' /user:'.$user.'/persistent:no'$my_error_var);

    if (
    $my_error_var) {

        
    //error routine here, write to log, die, exit, throw exception, etc.


    I just know that I've had many issues for customers over the years (back when I did that stuff) with SAMBA-related sharing issues, and also that Windows maps by user (so, I can do "T:" in my CMD shell here, no problem, but if I run CMD as Administrator it has no idea "T:" exists ...), so I'd think it wise to ensure that this non-persistent drive mapping actually worked before I tried to read or write with it.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    472
    I ended up removing WAMP and manually installed PHP and that solved the issues.
    Bob Lob Law

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •