0

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.

2
  • 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.
    – SpamapS
    Nov 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. :)
    – jrg
    Jan 24, 2012 at 14:09

2 Answers 2

1

It sounds like you're running apache as root, which is generally a bad idea. ESPECIALLY when you're allowing files to be uploaded.

1
  • how can i configure it?
    – shantanu
    Nov 14, 2011 at 18:49
0

This is how to change file permissions https://help.ubuntu.com/community/FilePermissions

2
  • 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.
    – shantanu
    Nov 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 and ls -la /var/www/?
    – user8290
    Jan 6, 2012 at 0:45

Not the answer you're looking for? Browse other questions tagged .