JohnWorks
New Pleskian
Hello community,
I have a problem connecting to my database. Remote Access is enabled (Go to Tools & Settings > Database Servers > Settings > click Local MySQL Settings: Select the Allow local MySQL server to accept external connections checkbox, and then click OK Link).
Database name, user and password are correct. Hostname is: localhost:3306
PHP: 7.4.30 FPM-Anwendung (Apache) mysqli is enabled
The data is in a subdomain, which is registered as a separate application.
Displayed error in the browser:
Displayed error in the log:
Plesk Obsidian 18.0.45 (Ubuntu) on IONOS
I have a problem connecting to my database. Remote Access is enabled (Go to Tools & Settings > Database Servers > Settings > click Local MySQL Settings: Select the Allow local MySQL server to accept external connections checkbox, and then click OK Link).
Database name, user and password are correct. Hostname is: localhost:3306
PHP: 7.4.30 FPM-Anwendung (Apache) mysqli is enabled
The data is in a subdomain, which is registered as a separate application.
PHP:
private $servername = "localhost:3306";
private $username = "user";
private $password = "pw";
private $dbname = "dbname";
private $conn;
function __construct() {
$this->conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
if ($this->conn->connect_error) {
die("Connection failed: " . $this->conn->connect_error);
}
$this->conn->set_charset("utf8");
}
Displayed error in the browser:
Code:
Connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Displayed error in the log:
Code:
AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/vhosts/domain/subdomain.domain.de/db.php on line 30PHP message: PHP Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/vhosts/domain/subdomain.domain.de/db.php on line 30', referer: https://subdomain.domain.de/login.php
Plesk Obsidian 18.0.45 (Ubuntu) on IONOS