开发者

php can't open or write file despite 777 permisions

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

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

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

thanks for your help


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.


You should be able to write mash.xml like this, but I suggest you also try chown to change the ownership, eg

chown www-data:www-data mash.xml

(www-data is the user group and user id of the apache user on most linux systems).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜