• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue MySQL php_network_getaddresses: getaddrinfo failed: Name or service not known

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.

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
 
Back
Top