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.

I have an Ubuntu server running a LAMP stack, and set up the permissions on /var/www such that all developers in our organisation are members of the www-data group, and the directory permissions are 2775 (rwxrwsr-x), file permissions should all be 664 - I've also set the default umask in /etc/profile to be 0002.

This all works great, except that any file created by PHP on the server only has permissions 644 (rw-r--r--)...

I'm trying to find something in PHP or Apache configuration (probably PHP) that sets new files to be 664 by default - is there such a beast?

Update:

I found the following information at http://ubuntuforums.org/showthread.php?t=549457

Adding the line:

umask 0002

to /etc/apache2/envvars and restarting the server should work.

I restarted, without error, but it doesn't seem to have changed a thing. My PHP-generated files are still not group writeable.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have you tried using PHP's umask() function? It's very possible that PHP enforces a set of file permissions of its own...

share|improve this answer
    
Thanks - interesting to see that, but I was hoping for a configuration option... –  HorusKol Apr 14 '11 at 5:08
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.