开发者

is_file or file_exists not working in apache but in CLI

开发者 https://www.devze.com 2023-01-07 02:21 出处:网络
I have a very strange behavior with is_file() or file_exists() function. <?php $nfsFile = \'/mnt/nfsdir/file.txt\';

I have a very strange behavior with is_file() or file_exists() function.

<?php 
    $nfsFile = '/mnt/nfsdir/file.txt';
    var_dump(is_file($nfsFile));
?>

this code开发者_如何学JAVA returns FALSE all the time, but:

$#php -r 'var_dump(is_file('/mnt/nfsdir/file.txt'));'

returns TRUE, which is correct.

I'm running Debian Squeeze, Apache 2.2.15 and PHP 5.3.2-1.

I'm not in safe mode, the directory /mnt/nfsdir/ and all files are in 777, www-data user can ls /mnt/nfsdir/ so I'm a bite out of idea now.

Any suggestion are welcome!


Looks realy like a server config issue to me.

Maybe test if echo exec('ls /mnt/nfsdir/file.txt'); works.

I don't think so. Cause it seams, even if www-data can access the file, PHP is not allowed to access it.

But if exec('ls /mnt/nfsdir/file.txt'); works this could be a solution for you.

Otherwise I would have a look at the server config again.

0

精彩评论

暂无评论...
验证码 换一张
取 消