![]() |
Easy PHP question - how to NOT use localhost
What do I put in the place of "localhost" if I want to use a database on a seperate server.
The server's IP? The server's DNS? Thank you. |
bump for an answer
|
i usally just put the address http://somehost.server.com i guess ip would work
, but i am pretty sure you have to have permissions on the database setup to allow outside connections |
You use the database hostname or the database host IP.
|
Does this look right? Because it's not working...
PHP Code:
The above gives me a parse error, changing $newconnect = mysql_pconnect(64.**.120.**, $user,$pass); to $newconnect = mysql_pconnect(localhost, $user,$pass); gives me "Incorrect database name..." but the page still shows. |
put the ip in quotes
|
Quote:
Quote:
|
so that worked or you still having trouble
|
Quote:
$newconnect = mysql_pconnect("64.**.120.**", $user,$pass); part gives me the error: Incorrect database name 'f***y_f*******s@64.**.120.**' |
cut @64.**.120.** from the dbname
|
In the connection code you can just replace localhost to ip adress but the database you are connecting to should allow remote connections to it. It shold be configed in the mysql side.
|
Quote:
Thank you very much. |
Do I go into cPanel and under "access hosts" add the IP address of the site that will be accessing?
|
Now I am getting
Access denied for user: '@localhost' to database 'f***y_f***s' How do I allow permission? I added the IP and domain to access host where the DB resides. |
All times are GMT -7. The time now is 03:32 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123