Jump to content

[Solved] Having issues connecting to MySQL database remotely with PHP


Recommended Posts

Posted

I have a MySql database set up on the johnny server and I'm trying to connect to it in a PHP-based webapp that I'm hosting locally with XAMMP. I've already added my local ip to Remote MySQL and added my user to the database. My config file looks like this:

<?php
// Database credentials
define('DB_SERVER', 'johnny.heliohost.com');
define('DB_USERNAME', 'myusername');
define('DB_PASSWORD', 'mypassword');
define('DB_NAME', 'mydatabasename');
 
/* Attempt to connect to MySQL database */
$mysqli = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
 
// Check connection
if($mysqli === false){
    die("ERROR: Could not connect. " . $mysqli->connect_error);
}
?>

When I load the page, all of the mysqli queries fail with this error message: "Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server."

Can anyone spot what I'm doing wrong? I've tried reading the documentation for information on how to connect remotely, but I wasn't able to get much from them.

Posted

Interestingly, the heliohost.com domain was registered 2 years before we existed, has never been used for anything, and has never been up for sale as far as we know. I suppose if they offered it to us at a reasonable price we would buy it because it is a common mistake that people put .com instead of .org.

  • Krydos locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...