Announcement

Collapse
No announcement yet.

Problem in Accessing database from another server - Urgent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem in Accessing database from another server - Urgent

    I have database on some sever and now i want to use this database from another server where my PHP files are hosted.

    I added a % host, I crated a user on my database server to access this database via C-Panel, this connection works on server itself if i use in php and also works on my local system.[ I can access this database from my local system but not from another live server]

    i am using following connection strings to access database:

    1. mysql_connect([IP-database server],[USER-ID],[PASS]);

    2. mysql_connect([IP-database server:3306],[USER-ID],[PASS]); i use port number along with ip like 193.189.75.113:3306

    3. mysql_connect([server-name],[USER-ID],[PASS]); i used server name instead of using ip

    4. mysql_connect([server-name:3306],[USER-ID],[PASS]); i used server name with Port number 3306 instead of using ip

    Please note that 1 and 2 works on local

    I request you to help me sorting this issue.

    I shall be thankful to you.

    Regards
    Last edited by vrakesh1; 30-03-2007, 09:24.

  • #2
    Hi,

    There are few possibilities for the above mentioned issue.

    Is APF firewall configured on the server hosting Mysql DB's ? If yes, is port 3306 open in the firewall ?

    Also, is 'skip-networking' commented/disabled the my.cnf file ? If it's enabled, it'll allow only local database connections & will stop all the remote ones.

    If you can provide us a link or domain name, we can get the issue diagnosed for you & possibly provide a fix for that.

    You can send us a ticket from here containing your server login details or email us at our support email address : support [at] eukhost [dot] com

    Awaiting your reply...
    Rock _a.k.a._ Jack Daniel

    Follow eUKhost on Twitter || Join eUKhost Community on Facebook

    Comment


    • #3
      Hello Rakesh,
      You are using DB on server A for connection from Server B. This is most often the scenario if there is no database Access on Server B. Most Probably, your remote Hosting Provider is not allowing outward connections to port 3306 or maybe blindly blocked 3306 in the firewall. Outward DB connections cause enormous network traffic and is therefore generally disabled.

      Confirm from the other server whether it is allowed or not.

      Regds
      IJ

      Comment


      • #4
        Thanks for reply.

        i think this is the reason that they are not allowing connection from outside servers.

        is it possible that they can provide facility to use include files which will be hosted on same server where my DB exists instead of providing remote database connectivity.

        Regards
        RAKesh vermA

        Comment


        • #5
          Rakesh,
          If you're hosted on eUKHost, yes, they do allow Database connection FROM outside. If you meant that the other host does not allow connection TO some other host, yes maybe you're right. Better to ask them and clarify.

          It is generally a wrong practise to connect between hosting servers unless absolutely necessary (e.g. for backup) as it causes unwanted network traffic besides slowing down your application to a snail's pace.

          Yes, it is possible to allow or disallow a particular feature at some level or the others. So includes maybe allowed, db connection not allowed.


          Regds
          IJ

          Comment


          • #6
            Thanks for reply.

            i think this is the reason that they are not allowing connection from outside servers.

            is it possible that they can provide facility to use include files which will be hosted on same server where my DB exists instead of providing remote database connectivity.

            Regards
            RAKesh vermA
            Hello again,
            Well your two line post baffled me for several minutes. I could not understand who is "they" and which server is your database server.

            Include files, in PHP you're asking I assume, will work using the FQDN (ex: include("http://somedomain.com/somefile.ext") ; ) from anywhere most often as it is being called via the HTTP method. It is possible that you can call that file from another server but not being able to connect to the DB on the server where the somefile.ext is residing.

            Hope that clarifies a bit.

            Regds
            IJ

            Comment


            • #7
              Thanks again for response,

              i am sorry i did not provide detail.
              My DB is hosted on web1.pingcorp.co.uk and my files are hosted on dcc.securepaynet.net

              now i have access to php.ini file only on dcc.securepaynet.net

              dcc.securepaynet.net people are saying that they dont allow connections from outside, they are providing only php.ini file to make changes.

              so is there any way so that i can access database from web1.pingcorp.co.uk by making any change in php.ini file

              default php.ini file which i found on my root is:

              ----------------------------------Start----------------
              register_globals = off
              allow_url_fopen = off

              expose_php = off
              max_input_time = 60
              variables_order = "EGPCS"
              extension_dir = ./
              upload_tmp_dir = /tmp
              precision = 12
              SMTP = relay-hosting.secureserver.net
              url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fields et="

              [Zend]
              zend_extension=/usr/local/zo/ZendExtensionManager.so
              zend_extension=/usr/local/zo/4_3/ZendOptimizer.so

              ----------------------------------Close----------------



              i changed allow_url_fopen = off to allow_url_fopen = on
              this allow me to use include file. i tried to put a db connection file on web1.pingcorp.co.uk and access it from dcc.securepaynet.net using PHP include statement.
              it successfully include file but i could not use the database class of that included file.

              i guess this include file is executed on server where file is hosted so i can not create objects of that included class...

              now what will be helpful for me is that

              is there any way so that i can access database from web1.pingcorp.co.uk by making any change in php.ini file which is on dcc.securepaynet.net

              Thanks for your valuable suggestions

              Regards
              RAKesh vermA

              Comment

              Working...
              X