title: How to safely execute user-submitted PHP code
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/825434/php-sandbox-sanitize-code-passed-to-create-function">PHP sandbox/sanitize code passed to create_function</a>  </p>
  </blockquote>
  
  
  
  <p>I apologize for the very generalized question, but I need some guidance. What is the most ideal way to execute user-submitted PHP code? Think JSFiddle for PHP. I know there are sites that do this such as <a href="http://writecodeonline.com/php/" rel="nofollow noreferrer">http://writecodeonline.com/php/</a> but I think that's PHP4 and doesn't work with half the code I try to run on it. I also know I could simply disable all the "risky" functions but, that's no fun :)</p>
  
  <p>I know it would be extremely handy having a PHPFiddle.com we could refer to on StackOverflow just as we've come to rely on JSfiddle or JSbin. </p>
  
  <p>I'm thinking something along the lines of creating a virtual host on my box so whatever filesystem functions the user tries to use will be limited to that sandbox. I'm not sure how to go about this though or if it would bring down my server having several of these running. </p>
  
  <p>Ideas?</p>