1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development PHP opendir returning "failed to open dir: not implemented" why?

Discussion in 'Software' started by Draxin, 13 Oct 2006.

  1. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    ok so im getting an error i dont understand

    Warning: opendir(http://localhost/tom/galleries): failed to open dir: not implemented in c:\program files\easyphp1-7\www\tom\index2.php on line 4

    now i cant give you all the code because it isnt mine to give. but heres the relevant stuff

    PHP:
    <?php
    function scan($base$add)
    {
        
    $directory "$base/$add";
        
    $dh opendir($directory) or die("There was problem opening $directory (scan)");
            
    // MORE WORK DONE HERE
    }

    $base "http://localhost/tom";
    $start "galleries";
    scan($base$start);
    ?>
    now iv been banging my head against the keyboard with no luck.

    what am i doing wrong
     
    Last edited: 13 Oct 2006
  2. DougEdey

    DougEdey I pwn all your storage

    Joined:
    5 Jul 2005
    Posts:
    13,933
    Likes Received:
    33
    I think, you need to use the local address. So for windows you'd need to do c:\rootdir\folder\ rather then passing http://....
     
  3. Firehed

    Firehed Why not? I own a domain to match.

    Joined:
    15 Feb 2004
    Posts:
    12,574
    Likes Received:
    16
    I don't suppose that's some sort of php addon, or something you can set in the php.ini file? It's possible the function is disabled and/or doesn't even exist. Or so I'd think from "not implemented". Maybe run a phpinfo() and see if opendir is anywhere on the page.

    That, or try losing the http:// - I think you may just want localhost/tom/galleries (or even just /tom/galleries) as your address. Windows-based servers especially can be really wierd that way. Not as confusing as when your code doesn't work on any system but the one it was coded on, but not all of us can be stupid enough to have short_tags enabled on their dev machine, and then actually *use* them in the code. :wallbash:
     
  4. simon w

    simon w What's a Dremel?

    Joined:
    3 Nov 2003
    Posts:
    1,302
    Likes Received:
    0
    Does the local web server support directory listing?
     
  5. spoon13

    spoon13 What's a Dremel?

    Joined:
    28 Aug 2006
    Posts:
    49
    Likes Received:
    0
    As simon is saying, you can only opendir a URL that has directory listing enabled.... is this configured correctly for the localhost web server?
     
  6. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    it has been mapped acordingly. strangely enough i tried the code again today without making any changes and it ran. well farther then it was getting, still outputting errors for other areas but for the time being its opening the directory.

    now its just caught in an infinate recursion and crashing my test server. oh where will it end.

    thanks guys. i don know what the problem was, or why it started working all of a sudden, but im glad it is.

    thanks again guys
     
  7. simon w

    simon w What's a Dremel?

    Joined:
    3 Nov 2003
    Posts:
    1,302
    Likes Received:
    0
    I assume $base will be a remote server when it goes live?
     
  8. Hwulex

    Hwulex What's a Dremel?

    Joined:
    1 Feb 2002
    Posts:
    4,007
    Likes Received:
    1
  9. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    simon-w
    $base will be the address of a remote server if need be, it is also set in another secion of the code so if the script is running locally it sets $base to the local server address and script path

    Hwulex
    the script is coded for php4 backward compat.
     

Share This Page