Files created by PHP

How can I configure to have files created by PHP not owned by "apache:apache" but owned by the domain user (e.g., "dev3:dev3")?

On my shared hosting account which uses CPanel, Apache is set to “suexec” to the domain user account of the virtual host so I don’t end up with permission problems creating/updating files in the public_html directory by PHP scripts.

I’m hoping I can configure my Webmin server similarly or I will have a mess in transfering my scripts/websites from the CPanel server.

This will be fixed with the addition of the FastCGI module to the default configuration. Sometime this coming week.

SuExec can be used now with PHP scripts if you opt not to use mod_php and instead execute them as standard CGIs (SuExec is enabled for all CGI scripts in cgi-bin), but performance will suffer for your PHP scripts. The standard SuExec doesn’t work for mod_php, so we have to use an additional module.

There are a couple of outstanding issues with getting FastCGI into the installer. One is getting support into Virtualmin, which will take a day or two after I send the specifics of how we’re going to do it and a copy of the wrapper script we’ll use over to Jamie. And the other, more difficult one, is a really annoying bug in FastCGI that leads to Apache shutting down on reconfigures…so Apache has to be hard restarted every time configuration changes. This would cause Virtualmin a lot of trouble, as it tries to use a reconfigure rather than restart when possible so that downtime is avoided.

Great! I’ll wait. It is so much more convenient, from a file permission point of view, to have all files in the public_html directory owned by the same user, even if they are created by PHP scripts.

I’ve used a host before where the PHP created files were owned by “nobody” and it was a real pain to make sure every directory that “nobody” wanted to create files in was writable by all. I’d think this kind of set up is kind of a security problem if you resell hosting on your system (which I’m not).