PHP7——is_writable总是返回false
我的服务器是centos 7 ,test.txt是我在 /var/www/html 上面新建的测试文件而已。
权限是
766 1 root root test.txt
通过chmod修改了nobody 【因为php.net上面说这个函数,的web访问是使用nobody身份】
766 1 nobody root test.txt
<?php
$filename = 'test.txt';
if (is_writable($filename)) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}
?>
最后结果是,在服务器上面的编译时可以写的,在web访问是不可以写。怎么办呢?