UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Web Hosting and Domains > PHP Hosting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-03-2007, 05:39
Junior Member
 
Join Date: Mar 2007
Posts: 3
Exclamation Problem in Accessing database from another server - Please Help

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 at 09:24.
Reply With Quote
  #2 (permalink)  
Old 30-03-2007, 22:56
Rock's Avatar
System Administrator
 
Join Date: Dec 2006
Posts: 572
Lightbulb

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 L.

http://www.eUKhost.com
Windows Hosting || Windows Reseller Hosting
Reply With Quote
  #3 (permalink)  
Old 01-04-2007, 17:04
Premium Member
 
Join Date: Jan 2007
Posts: 209
Default

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
Reply With Quote
  #4 (permalink)  
Old 02-04-2007, 05:45
Junior Member
 
Join Date: Mar 2007
Posts: 3
Default

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
Reply With Quote
  #5 (permalink)  
Old 02-04-2007, 12:28
Premium Member
 
Join Date: Jan 2007
Posts: 209
Default

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
Reply With Quote
  #6 (permalink)  
Old 02-04-2007, 12:39
Premium Member
 
Join Date: Jan 2007
Posts: 209
Default

Quote:
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
Reply With Quote
  #7 (permalink)  
Old 03-04-2007, 09:39
Junior Member
 
Join Date: Mar 2007
Posts: 3
Default

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
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:01.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories