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!


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.

  • +1 Thanks, can this be done in mod_php? – Zim3r Sep 24 '12 at 7:29

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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