title: How to Restrict PHP's File Access to DOCUMENT_ROOT
body: <p>Is it possible to restrict PHP's file access to its document root? Basically on my work's server we have our domains in a file structure like:</p>
  
  <pre>
  /home/something/domains/domain1/
  /home/something/domains/domain2/
  /home/something/domains/domain3/
  </pre>
  
  <p>Right now, any script on domain1 has read and write access to anything in  /home/something/domains/ including all of our other domains. I would like to restrict file access for a script in domain1 to only that domain. </p>
  
  <p>The server is hosted with mediatemple and it is their grid service, so I don't have root access or even vhost config access. We can change php.ini, and i know it offers open_basedir, but it doesn't sound like that solves my problem as I could only restrict file access to /domians/ and not the individual domains. Any help appreciated.</p>
  
  <p>What I'm really trying to do:</p>
  
  <p>This server was recently hacked, and the hackers were overwriting domains/.htaccess which affected all our sites. We have tons of sites and many of them have lots of lines of bad code. They uploaded WSO, a hacking backdoor/shell which gave them full access to everything.  I don't know how they got access, I guess it was either from the timthumb exploit, one of the millions of lines of bad code, or they just got our FTP password somehow. We updated old timthumbs, changed the password and removed all the bad files we found, but since there is a decent chance whatever exploit they found is still on the server, or that we missed some backdoor, I would at least like to limit their access to the actual domain that contains the exploit or unfound backdoor.</p>