why would a directory fail the is_dir() test?

From: lawrence (lkrubner_at_geocities.com)
Date: 05/01/04

  • Next message: Matt: "Re: No PHP Error. Just "Page Cannot be displayed""
    Date: 30 Apr 2004 16:20:44 -0700
    
    

    In the function below, before I open the directory I first test to
    make sure the address I have is, in fact, a directory. This function
    was working fine on one web server running FreeBSD and PHP 4.06.
    However, today I'm trying to run this software on a new server (RH
    Linux 9, PHP 4.2.3) and the directory is failing the is_dir() test.
    The error message that I have in my code is printing out this error:

    In getListOfAnyDirectory(), we expected the function to be handed an
    address to a directory, but instead we were given this:
    ppArrangementsPublic/.

    Now, ppArrangementsPublic/ looks like a directory to me. So why is it
    failing the test?

    function getListOfAnyDirectory($address=false) {
            // 03-17-04 - this function should be given an address to a folder.

            $controllerForAll = & getController();
            $resultsObject = & $controllerForAll->getObject("McResults", " in
    getListOfAnyDirectory().");
            $theDirFilesArray = array() ;
            
            $address2 = str_replace("/", "", $address);

            if (is_dir($address) || is_dir($address2)) {
                    // open the directory and load all the files into an array
                    $theDir = @ opendir($address);
                    
                    if ($theDir) {
                            // We go through the array one element at a time, putting it into a
    new array, minus invisible files
                            //marked by "." and ".."
                            
                            while ($theDirFiles = readdir ($theDir)) {
                                    if ($theDirFiles != "." && $theDirFiles != "..") {
                                            $theDirFilesArray[] = $theDirFiles ;
                                    }
                            }
                            
                            closedir ($theDir) ;
                            return $theDirFilesArray;
                    } else {
                            $resultsObject->error("In getListOfAnyDirectory(), we tried to open
    the directory at the address $address, but for some reason it didn't
    open.", "getListOfAnyDirectory");
                    }
            } else {
                    $resultsObject->error("In getListOfAnyDirectory(), we expected the
    function to be handed an address to a directory, but instead we were
    given this: $address.", "getListOfAnyDirectory");
            }
    }


  • Next message: Matt: "Re: No PHP Error. Just "Page Cannot be displayed""

    Relevant Pages

    • Re: ADSI script for IIS 5.0 can not run in IIS 6.0
      ... You have given insufficient information on what exactly is failing. ... The error message comes after the running of SiteObj.SetInfo ... .AccessScript = True ... ' These properties are common to ROOT dir and to the web server ...
      (microsoft.public.inetserver.iis)
    • Re: on input form showing error message for duplicate entry.
      ... | Subject: Re: on input form showing error message for duplicate entry. ... |> same validation in php since not all your visitors/customers will have ...
      (alt.php)
    • Re: [PHP] Re: http request problem
      ... while i am trying to access to another file, from another server it run ... this is the error message i get: ... browser on the same network where it fails in the PHP script? ... know your requests actually hit the server, ...
      (php.general)
    • PHP logs not working, and unable to send mail through sendmail via PHP
      ... am unable to view my php error log. ... logging and my mail options and suggest some things for me to try ... error displaying on production web sites. ... String to output before an error message. ...
      (comp.lang.php)
    • Re: [PHP] Re: http request problem
      ... however i did try to access other jsp file from the same server, ... i don't know why i keep getting the same error message file accessing ... browser on the same network where it fails in the PHP script? ... know your requests actually hit the server, ...
      (php.general)