Jump to content

Recommended Posts

HI,

I have two webserver and two domain and I want to share information between them.What I want to do is this to share the database between two webserver so ,if I add  new information through domain 'A' that information can can be catch from domain "B" and I have that information in domain 'B'.Also the files in one server should be share between two webserver so If I add a new file or make a change in it in domain 'A' it can be retrieve from domain 'B' an I can use it in there.

 

I apologize if it's not so clear .My English is not good.

 

Thanks

The database for the 2 servers can be a common database accessed by both. It can either be on one of the webserver machines, or on a completely separate machine. You need to ensure that the host part of the database connection string, is pointing to the machine on which the database resides.

The database for the 2 servers can be a common database accessed by both. It can either be on one of the webserver machines, or on a completely separate machine. You need to ensure that the host part of the database connection string, is pointing to the machine on which the database resides.

Can you give me more detail.How can I do so?

 

Thanks for your help

Ok, a normal set of connection variables looks like

 

$dbhost = 'localhost';

$dbuser = 'username';

$dbpass = 'password';

$dbname = 'databasename';

 

and you then call mysql_connect() and mysql_select_db() to connect to the database.

 

that is still fine for a webserver where the database server is running on the same machine.

 

If you wish to connect to a database server on another machine, you simply put the IP address of the server where the database is, in the host variable, replacing the word localhost.

 

So you get

$dbhost = '1,2,3,4';  where 1.2.3.4 is the IP address.

 

If the database is on a different machine to either webserver, which is quite common on busy sites, then both webserver machines will need to specify the IP address of the server containing the database server.

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.