title: PHP safemode alternative
body: <p>Safe Mode is deprecated as 5.3.0. I have never really required it and rather found it problematic many times in the past due to permission errors, etc.</p>
  
  <p>However I now have a requirement where I think safe mode would have done great.</p>
  
  <p>I have built a web application which is extensible via modules. I plan on hosting the system myself and allowing paying customers to extend their software by implementing and writing modules which hook into the various parts of the system.</p>
  
  <p>My concern is, by doing so, I have no way of ensuring the code they uploaded is not scanning the foundation/framework I have spent literally years designing and testing. Keep the code proprietary is of great interest to me.</p>
  
  <ol>
  <li><p>I write a module analysis tool to ensure no illegal methods are being invoked in third party modules - not easy!!!</p></li>
  <li><p>I Disable harmful functions at the php.ini level but this includes fopen() and it's ilk - this means the framework won't be able to call it's own include() operations and such.</p></li>
  <li><p>Lastly and sadly obsolete, safe mode to restrict user modules from being able to read files which do not share the same ID, group, etc.</p></li>
  </ol>
  
  <p>What is the recommended approach to such a thing? Short of manually reviewing or auto-analysing each module before being executed in the context of my framework?</p>