文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php教程>如何解决php is_writable 失败问题

如何解决php is_writable 失败问题

时间:2021-09-26  来源:互联网

今天PHP爱好者给大家带来php is_writable失败的解决办法:1、打开命令窗口;2、执行“chcon -R -t httpd_sys_content_rw_t /var/www/html”即可。希望对大家有所帮助。

本文操作环境:centos7系统、PHP7版,DELL G3电脑

如何解决php is_writable 失败问题?

具体问题描述:

PHP7 is_writable总是返回false!

我的服务器是centos 7 ,test.txt是我在 /var/www/html 上面新建的测试文件而已。

权限是766 1 root root test.txt

通过chmod修改了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访问是不可以写。怎么办呢?

27f728296485e0c535ce43141007f12.png

解决办法:

chcon -R -t httpd_sys_content_rw_t /var/www/html

以上就是如何解决php is_writable 失败问题的详细内容,更多请关注php爱好者其它相关文章!

相关阅读更多 +
最近更新
排行榜 更多 +
元梦之星最新版手游

元梦之星最新版手游

棋牌卡牌 下载
我自为道安卓版

我自为道安卓版

角色扮演 下载
一剑斩仙

一剑斩仙

角色扮演 下载