I installed php5 , mysql and apache2 without any error. Everything is working fine. apache2's Root directory is /var/www (permission is 775). Problem is when i upload a file using php code it change the owner of uploaded file (as root). So i can not read this file from another code without changing owner of file manually. Is there is anyway to solve this problem? Should i add user to php group (how)? Thanks in advance.
-
shantanu, can you explain how you installed apache2 and php5? It will help clarify how your file was owned by root, and help us answer your question.– SpamapSNov 22, 2011 at 19:31
-
This question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :)– jrgJan 24, 2012 at 14:09
Add a comment
|
2 Answers
It sounds like you're running apache as root, which is generally a bad idea. ESPECIALLY when you're allowing files to be uploaded.
This is how to change file permissions https://help.ubuntu.com/community/FilePermissions
-
It is not possible to change file permission manually(not practical ). uploaded file is owned by root so it is also not possible to run chown using php.– shantanuNov 24, 2011 at 7:35
-
It is actually possible to chown with PHP by specifying the right config in sudoers. BUT your files should NOT be owned by root unless the webserver is running as root, or /var/www does not really have 755 permissions. How about posting the output from
ps aux | grep apache
andls -la /var/www/
?– user8290Jan 6, 2012 at 0:45