尽管有777个权限,php仍无法打开或写入文件 [英] php can't open or write file despite 777 permisions

查看:212
本文介绍了尽管有777个权限,php仍无法打开或写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的php脚本无法写入文件777权限. 我要写的文件是mash.xml

My php script is unable to write a file despide 777 permission. the file i want to write is mash.xml

-rwxrwxrwx. 1 root root   459 May 16  2010 config.xml
-rwxrwxrwx. 1 root root   323 May 16  2010 handler.xml
-rwxrwxrwx. 1 root root 13908 Mar 15 12:18 mash.xml
-rwxrwxrwx. 1 root root   494 May 17  2010 media_audio.xml
-rwxrwxrwx. 1 root root 13967 Feb 15 07:40 media_effect.xml
-rwxrwxrwx. 1 root root   312 May 16  2010 source.xml

我检查了以下问题: -与文件上传器相同的用户var_dump(get_current_user());显示根"

i checked the following issue : - same user as file uploader, var_dump(get_current_user()); displays "root"

这是Apache日志:

this is apache log :

[error] [client 155.132.8.52] PHP Warning:  
fopen(/var/www/html/moviemasher_3-1-04/example/save/media/xml/mash.xml): 
failed to open stream: 
Permission denied in /var/www/html/moviemasher_3-1-04/example/save/media/php/save.php 
on line 14

感谢您的帮助

推荐答案

如果启用了SELinux:

If SELinux is enabled:

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/moviemasher_3-1-04/example/save/media/xml/mash.xml"

随意使用正则表达式作为文件名.

Feel free to use a regex for the filename.

这篇关于尽管有777个权限,php仍无法打开或写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆