Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have a strange question, but I'm working on a script to deploy a PHP codebase and want to see if something like this is possible:

I have a directory that Apache uses as a DocumentRoot:


We have a PHP app that must add several files and directories to this directory.

We are currently doing this by SCP'ing a tarfile and extracting it in /home/www. I'm looking to do this in a better way because when we are extracting the files, our PHP app gets some read permissions errors. I'd like to update these file atomically inside /home/www (and preferably "at once")

Is there a way to do this without having to make a symlink to every file/directory that I'm extracting into the web directory?

share|improve this question

I generally will setup something like this.

/var/www/production (document root, symlink -> current version)

So basically you just upload to a new directory, once the upload is complete tweak your symlink and everything changes at once.

When applications are designed in a way to separate code from the application (like they should!), then life is a lot more complicated. You may have to do something with a unionfs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.