2011-11-30 10:47
浏览 48


A client of mine owns 2 dedicated servers - both running php 4.3. One server (the main) has lots of applications with online payments. He has install SSL key in one subdomain to run the payment procedures. So we have and, both sharing the same databases.

Now, on his other server (, he wants to upgrade to latest php/mysql. He wants to install another ssl there (, and he wants to transfer all applications from first secure domain, to the new one.

Is there a way to share the databases in the second server? So php scripts can still work and store/retrieve data in the database in first server (

EDIT: the two servers (example-one and example-two are running in different IPs)

图片转代码服务由CSDN问答提供 功能建议

我的客户拥有2台专用服务器 - 都运行php 4.3。 服务器(主)有很多 在线支付申请。 他已在一个子域中安装SSL密钥以运行付款程序。 我们有www.example-one.com和 共享相同的数据库。

现在,在他的另一台服务器(上,他想升级到最新的php / mysql。 他想安装另一个 ssl那里(,他想将所有应用程序从第一个安全域转移到新域。

有没有办法分享 第二台服务器中的数据库? 那么php脚本仍然可以在第一台服务器(的数据库中工作和存储/检索数据?

编辑:这两台服务器 (example-one和example-two在不同的IP中运行)

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • drvkf88226 2011-11-30 10:55


    It all depends on your physical infrastructure, but if the servers running example-one and example-two can "see" each other across the network - ideally, a non-public network running inside your hosting facility, or a well-secured VPN across the internet - you can connect the PHP apps running on and to the MySQL database on by setting the connection string to point at whatever its hostname or IP address is.

    You should NOT run this connection over the public internet or any benefit of using SSL on the web application is wiped out.

    解决 无用
    打赏 举报
  • dongyao5186 2011-11-30 10:54

    If we assume that DB is MySQL, then sure, you can make it listen on a public IP address, restrict access to example-two, and point PHP scripts of example-two to the database of example-one.

    Another option is to make a master-master replication between those 2 servers, that would require installing 2nd instance of MySQL on example-two and some careful consideration as to whether application using it won't break (read: auto_increment increment).

    Some instructions on MySQL master-master replication

    解决 无用
    打赏 举报
  • dongqi8863 2011-11-30 10:55

    you can access every database you like if they are proper configured.

    securest way is to have a own backend lan for this.

    if you cant you could open mysql on the public ip adress (and filter via iptables to allow only example-two access) add an user to mysql with the proper rights and you are done. (its more a problem of securing the exposed mysql then the actual configuration of mysql is)

    解决 无用
    打赏 举报

相关推荐 更多相似问题