Phpfanboi Posted August 23, 2010 Share Posted August 23, 2010 <?php $dbhost = "localhost"; <-(replace 'localhost' with server ip ?) $dbuser = "root"; $dbpassword = ''; $dbdatabase = "productsdb"; and so on .. For remote access to my hosted database via another machine what do i replace "localhost" with ? is it the ip address for my server? How do i point this function to the remote server? I know i have to allow for the incoming ip address (users machine) in c-panel using the wild card feature , but i am not sure if i am meant to replace the "localhost" part in my connection function , with the ip address where my database is remotely living. If i am meant to be using the web host ip address , im guessing i have to find it on c-panel , how do i do this , any information would be good thankyou. Quote Link to comment https://forums.phpfreaks.com/topic/211474-mysql-connection-remote/ Share on other sites More sharing options...
trq Posted August 23, 2010 Share Posted August 23, 2010 Yes, you need to replace the localhost domain with either the ip address or domain name of your mysql server database. Quote Link to comment https://forums.phpfreaks.com/topic/211474-mysql-connection-remote/#findComment-1102603 Share on other sites More sharing options...
Phpfanboi Posted August 23, 2010 Author Share Posted August 23, 2010 Yes, you need to replace the localhost domain with either the ip address or domain name of your mysql server database. So i can use for instance ; $dbhost = "http://www.mydatabase.com"; $dbuser = "root"; $dbpassword = ''; $dbdatabase = "productsdb"; and so on .. Is this the correct method?Also can you help me find my ip address for my server , is it located in c-panel?Thank you very much for your hastly reply.cheers Quote Link to comment https://forums.phpfreaks.com/topic/211474-mysql-connection-remote/#findComment-1102610 Share on other sites More sharing options...
trq Posted August 23, 2010 Share Posted August 23, 2010 No, http is the webs protocol, not part of a domain name. www is generally a subdomain on that server specifically used for serving web content. Your hostname entry should look more like..... $dbhost = "mydatabase.com"; Be aware though that using a hostname is going to be slower than an ip. If you know the domain you can find the ip easily enough by pinging it (I don't/won't use Cpanel). Quote Link to comment https://forums.phpfreaks.com/topic/211474-mysql-connection-remote/#findComment-1102613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.