Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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 '11 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 '12 at 14:09
add comment

closed as too localized by Marco Ceppi Jan 24 '12 at 15:53

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

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.

share|improve this answer
    
how can i configure it? –  shantanu Nov 14 '11 at 18:49
add comment

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

share|improve this answer
    
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 '11 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 '12 at 0:45
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.