php not opening file on mounted filesystem

136 views Asked by At

I have the following bit of code that is giving me problems.

#$fullfilename="/data/extract/".$curpkg."/".$curfilename;
$fullfilename = "/tmp/test.txt";
$readline = 0;
$lictext="";
try {
     $file = new SplFileObject($fullfilename);
     $readline=$curline-1;
     while ($readline <= ($curline -1 + $curlinecount)) {
          $file->seek($readline);
          $lictext = $lictext . $file->current()."\n<br>";
          $readline = $readline + 1;
     }
} catch (Exception $e) {
     $lictext = "couldn't open it $fullfilename<br> Exception: $e<br>";
}

When I use the currently uncommented $fullfilename variable declaration, it works fine, but when I use the code that is commented out it does not. I get the following error:

couldn't open it /data/extract/test.txt 
Exception:     exception 'RuntimeException' with message \
'SplFileObject::__construct(/data/extract/test.txt):\
failed to open stream: No such file or directory' in \
/srv/www/htdocs/legal/index.php:70
Stack trace:
#0 /srv/www/htdocs/legal/index.php(70): \
SplFileObject->__construct('/data/extract/test.txt')

The only difference is that the data I want to use is a separate drive mounted at /data. Permissions for the entire structure are 777: drwxrwxrwx 2 root root 53248 Jan 7 14:31 data.

I am at a loss here, I have the same problem with file_exists() and is_readable(). Can anyone give me some guidance here?

0

There are 0 answers