尽管有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.