When I run this:
$file = tmpfile();
$name = stream_get_meta_data($file)['uri'];
$nfile = new SplFileObject($name);
var_dump($nfile);
from the command line, it works as expected - creating a temporary file, and dumping details about it. However, when I run it through apache, $nfile is an empty object - it seems to be unable to access the file by path. Why is this? I have already confirmed that it is creating a file, and I can see the temporary file in the file system, so it's just php that can't reach it.