hno Posted January 24, 2010 Share Posted January 24, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189612-how-to-share-information-with-two-webserver/ Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189612-how-to-share-information-with-two-webserver/#findComment-1000767 Share on other sites More sharing options...
hno Posted January 24, 2010 Author Share Posted January 24, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189612-how-to-share-information-with-two-webserver/#findComment-1000861 Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189612-how-to-share-information-with-two-webserver/#findComment-1000868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.