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
Share on other sites

The part in cPanel that asks for a remote host would need to be the hostname (or ip address) of the site you wish to allow access to your database.

 

The part in your connection however would need to be the name of the server hosting the database.

Link to comment
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?

 

Link to comment
Share on other sites

Ummm...

The part in your connection however would need to be the name of the server hosting the database.

 

Is your database server hosted on the mysite.com IP address or does it actually have some other host name or IP address?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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