Question

Let's say I have 3 websites hosted in server a, b and c, they all use some of the same files (library.php, users.php, config...). Right now all website have those files, and if I want to update 1 of the files I have to do it for all websites. Very inefficient.

The question is could I have a central server that hosts those common files and when one of the websites is loaded I get PHP to call library.php, users.php... from the central server?

Was it helpful?

Solution

You COULD use a central server, or set one of the 3 servers as the shared respository for all files, but that is going to cause unnecessary network overhead and also reintroduce a single point of failure.

A better method would be to implement a set of scripts that would keep the servers in sync.

Rsync can be used for this, but there are any number of options including using git. (You DO use source code management right?)

Capistrano is also a good option.

Also see answers here: Deploying to multiple servers

OTHER TIPS

Put them in a shared directory on your server and add them to the PHP include path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top