Apache Web-Serving with Mac OS X, Part 4
Subject:   Apache Permissions and PHP mkdir()
Date:   2002-04-10 08:49:55
From:   tedmasterweb
On OS X by default Apache runs as the user www and belongs to the group www. Also, by default, when I create a new directory in /Library/WebServer for use as a virtual host (for development purposes, let's say), the directory is created with me as the owner and admin as the group. This is a problem if you want to allow Apache to modify the directory structure because www is not a member of the admin group.

Unless I set the write permissions for the new directory to all writable (773, for example), mkdir() fails due to permissions.

My question is, is there a good resource out there that discussions or demonstrates how to manage user permissions without just hacking away (so that errors are handled gracefully)?

I realize I can just make the directory world-writeable, which isn't a terrible alternative given that this is on my development machine, but it doesn't seem like the right thing to do.


Ted Stresen-Reuter

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Morbus Iff photo Apache Permissions and PHP mkdir()
    2002-04-16 17:24:37  Morbus Iff | O'Reilly Author [View]

    Apache does come with a "suexec" option, which allows you to say "hey, run these CGI scripts as morbus/users". By so doing, all files your scripts create would be owned by the "morbus" user, and would have the default umask normally set (644, I believe).

    I don't know if PHP has the same ability, but it does have a chown function so you may want to experiment there.