0

I have a very big code base which i need to duplicate for law reasons.

the "source website": domain: example.com documentroot /home/mywebs/web1

i need to clone it to: domain: copy.example.com document root: different from /home/mywebs/web1

example.com uses many php skripts, which are using "raw access" to file system - like:

$fp = fopen("/home/mywebs/web1/tmp/users.dat","r");

it makes hard to truely duplicate it.

My idea is to create a "container" in the directory

/container and let it be a virtual root "/"

within this root i create

/home/mywebs/web1 and copy all the data from example.com but the php-scripts file access to "/home/mywebs/web1" need to go to "/container/home/mywebs/web1"

anyidea how to do this?

Steven
  • 61
  • 1
  • 3
  • 10
  • 1
    man chroot. It's exactly what you need (other than not using hard-coded strings like that). – Paul Hicks Feb 01 '15 at 21:18
  • ok - but it should not have any side effect - i cannot chroot the entire apache, i need to create a second process and chroot it or what to do excactly? – Steven Feb 02 '15 at 22:14
  • There are a few options, but you could replace "/home/mywebs/web1" with "/" and chroot from within your application's main process(es). Then a global search and replace of "/home/mywebs/web1/" with "/" should fix everything. Apache wouldn't be within the chrooted application. – Paul Hicks Feb 02 '15 at 23:48
  • Alternatively, globally search and replace "/home/mywebs/web1/" with "$approot/" or whatever the php equivalent is... then you wouldn't even need to chroot. – Paul Hicks Feb 02 '15 at 23:49
  • hello - i did it all with a combination of find, grep and sed - thank you! – Steven Feb 04 '15 at 00:00
  • Well done. I think that makes this a not-a-programming-related question, though! – Paul Hicks Feb 04 '15 at 03:13

0 Answers0