Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

/home/www/

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

1 Answer 1

I generally will setup something like this.

/var/www/version1
/var/www/version2
/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

 
discard

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.