file_exists alway returns false

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • annie

    #1

    file_exists alway returns false

    Hi

    I've got two linux boxes running redhat9 and either PHP Version 4.2.2
    or PHP Version 4.3.7. The file structure is set up the same on both
    machines and both files exist. The problem is not file specific and
    on both machines seq_tables is a symbolic link to another location.

    It makes no difference to either version of php whether I use double
    or single quotes when asigning a value to $filename. Nor does it
    matter whether I use single or double, forward(/) or back(\) slashes
    in the path.

    I don't use open_basedir in either php.ini file so this warning
    doesn't apply. 'If you use open_basedir in php.ini and use file_exists
    for file outside open_basedir path, you will not be warned at log and
    file_exists returns false even if file really exists.'

    So what else could cause the file to be found on the 4.2.2 version but
    not on the 4.3.7 version? Any hints will be much appreciated.

    Annie




    <?php

    #####test script######### ############### ####
    $filename = '/var/www/html/seq_tables/lumbricus/sequences/CF610635';

    if (file_exists($f ilename)) {
    print("The file $filename exists<br>");
    } else {
    print("The file $filename doesn't exists<br>");
    }
    ############### ############### ###############
    ?>
  • Phil Powell

    #2
    Re: file_exists alway returns false

    bahhab@hotmail. com (annie) wrote in message news:<5b4ae9b7. 0411090222.51fd 841c@posting.go ogle.com>...[color=blue]
    > Hi
    >
    > I've got two linux boxes running redhat9 and either PHP Version 4.2.2
    > or PHP Version 4.3.7. The file structure is set up the same on both
    > machines and both files exist. The problem is not file specific and
    > on both machines seq_tables is a symbolic link to another location.
    >
    > It makes no difference to either version of php whether I use double
    > or single quotes when asigning a value to $filename. Nor does it
    > matter whether I use single or double, forward(/) or back(\) slashes
    > in the path.
    >
    > I don't use open_basedir in either php.ini file so this warning
    > doesn't apply. 'If you use open_basedir in php.ini and use file_exists
    > for file outside open_basedir path, you will not be warned at log and
    > file_exists returns false even if file really exists.'
    >
    > So what else could cause the file to be found on the 4.2.2 version but
    > not on the 4.3.7 version? Any hints will be much appreciated.
    >
    > Annie
    >[/color]

    This might sound a bit simplistic, but did you verify if the file
    exists via command-line? "ls -l ../myfile"? Also check permissions
    on the file, if Apache (or whatever webserver you use) has no
    permissions to at least read that file you could return a false on
    file_exists() even though the file really does exist (I have run into
    that in the past).

    Phil
    [color=blue]
    >
    >
    >
    > <?php
    >
    > #####test script######### ############### ####
    > $filename = '/var/www/html/seq_tables/lumbricus/sequences/CF610635';
    >
    > if (file_exists($f ilename)) {
    > print("The file $filename exists<br>");
    > } else {
    > print("The file $filename doesn't exists<br>");
    > }
    > ############### ############### ###############
    > ?>[/color]

    Comment

    • annie

      #3
      Re: file_exists alway returns false

      I don't think it's just a permissions thing. I believe something is
      set to allow the seq_tables directory to be read on PHP Version 4.2.2
      or to stop it from being read on PHP Version 4.3.7 but I can't find
      anything like this in the ini file. Perhapse it's an apache setting?

      see links for example of problem. Any other thoughts appreciated.


      and


      Annie

      Comment

      • Chung Leong

        #4
        Re: file_exists alway returns false

        I think it's a permission issue. Accessing the URL
        http://trichuris.cap.ed.ac.uk/seq_tables/test.txt yields a 403 error.

        "annie" <bahhab@hotmail .com> wrote in message
        news:5b4ae9b7.0 411220852.baaf3 d8@posting.goog le.com...[color=blue]
        > I don't think it's just a permissions thing. I believe something is
        > set to allow the seq_tables directory to be read on PHP Version 4.2.2
        > or to stop it from being read on PHP Version 4.3.7 but I can't find
        > anything like this in the ini file. Perhapse it's an apache setting?
        >
        > see links for example of problem. Any other thoughts appreciated.
        >
        > http://zeldia.cap.ed.ac.uk/Lumbribase/file_exists.php
        > and
        > http://trichuris.cap.ed.ac.uk/Lumbri...ile_exists.php
        >
        > Annie[/color]


        Comment

        Working...