Jump to content

connect to remote host


inosent

Recommended Posts

i have a working set of php pages that finally do what i want them to. however, the database is located at my site, but i need to host the web pages on the company site, and i am not able to create a mysql db there, but the site is php enabled and i have permissioned this particular site to access the db at my site using the cPanel.

 

this is my dbinfo.inc.php file

 

<?php
$username="user";
$password="pass";
$database="dbname";
?> 

 

the connection line in every file, which works when the pages are hosted locally, is

 

  mysql_connect(localhost,$username,$password);

 

so obviously the term 'localhost' wont work.

 

at my site in the cPanel i see this:

 

"Remote Database Access Hosts

 

You can allow external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site.

Add Access Host

 

Host (% wildcard is allowed):"

 

and i added the site name where i want the pages to be in these various ways:

 

thesite.com

www.thesite.com

%thesite.com

%www.thesite.com

 

i have been inserting these where 'localhost' is, but i cannot make a connection.

 

any thoughts on this would be appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/203042-connect-to-remote-host/
Share on other sites

yeah, this is the sort of thing that is hard to make work because i dont have control over the server i want the pages on

 

my site is 'mysite.com' and the site where i want the pages located is 'thesite.com'

 

i uploaded the pages to thesite.com and changed localhost to 'mysite.com' with single and double quotes, even tried 'www.mysite.com' but no connection.

 

probably something about 'thesite.com' that blocks this sort of thing? is that possible?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.