[英]folder permission 777 not working
In hosting server we set a 777 permission for folders, but we can't write the files in folders, and also we check the is_writable php code to check the permission, 在托管服务器中,我们为文件夹设置了777权限,但是我们无法在文件夹中写入文件,而且我们还检查了is_writable php代码以检查该权限,
if (is_writable($dir)) {
echo $dir, ' is writable';
} else {
echo $dir, ' is NOT writable';
}
but its showing "is NOT writable" 但显示“不可写”
Check the selinux context (command: ls -Z /directory_path) of that folder. 检查该文件夹的selinux上下文(命令:ls -Z / directory_path) 。
It is suppose to be httpd_sys_content_t for apache http. 假设是apache http的httpd_sys_content_t 。 If it is not set then change it to this.
如果未设置,则将其更改为此。
chcon -h system_u:object_r:httpd_sys_content_t /directory_path
chcon -h system_u:object_r:httpd_sys_content_t / directory_path
you can check your filename. 您可以检查您的文件名。 or file path.
或文件路径。
Bacuse your using style is correct. 因为您的使用风格是正确的。
Maybe a little careless. 也许有点粗心。 Thanks.
谢谢。
<?php
$file= 'try.txt';
if (is_writable($file)) {
echo 'writable';
} else {
echo 'not writable';}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.