php apache permissions - best practices [closed] php apache permissions - best practices [closed] codeigniter codeigniter

php apache permissions - best practices [closed]


Generally what I do is chgrp any directory php will write to the group apache runs as (www on my server, could be apache on yours), chmod g+s . This will make any file created in that directory also owned by the web server group. If the default umask allows group write, this will solve your problem.


The best practice is to only allow users to read/write files that they should.

In my web-apps, I have a data directory for the website, which I store all my dynamically generated data from the app.

Then I only give permission for the app to write to that directory, and nothing else.