Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A php script uploads files to my server but folders MUST be 0777 in order to allow PHP to move files there. This is not safe. Additionally, all created directories and uploaded files are owned by apache and not by me. How can I change PHP's configuration so that uploaded files can be moved to a folder with permissions 0755 and created directories are owned by me?

Thank you!

share|improve this question
add comment

2 Answers 2

Create a new group which both you and Apache are a part of. Then you can set permissions to 775. It's not super secure, but its a fast fix from 777ing everything.

share|improve this answer
    
+1 Thanks, can this be done in mod_php? –  Zim3r Sep 24 '12 at 7:29
add comment

Either use suPHP or PHP in FastCGI mode with php-fpm.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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