In his quest for a secure method of server-side security in addition to PHP, Ben Ramsey stumbled across Peruser MPM, an Apache security module, seemingly with PHP in mind. In this latest blog post he details what lead him there.
Sure, there’s PHP’s safe_mode, but its "safety" is misleading at best. There’s also open_basedir, which helps a little, but it’s not quite enough. For my research, I also looked at and tested mod_security, and the Hardened PHP Project’s Hardening Patch.
A while back, when I was doing some research for a talk on server-side security for PHP, I looked into various "secure" methods for setting up a server for multiple users. Despite my search, I couldn’t find a simple and effective solution for managing a server with a large (and untrusted) user base (as is the case with many virtual hosting companies).
Eventually, through this comment, he found Peruser MPM, a module that runs each Apache process with its own user/group combination. He notes a few issues that it still has (breaking mod_ssl and making Apache less scalable), but overall, it does sound pretty cool...