eZ Platform Discussions

eZ Launchpad - An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known


#1

Bonjour à tous.

I have a “funny” problem with my eZ Launchpad.

My website is working well (admin and front).
The clear-cache command works.

ez sfrun "cache:clear"

OK

But commands that use the database do not work.

Example :

ez sfrun "ezplatform:check-urls"

In ExceptionConversion.php line 104:
Database error

In AbstractMySQLDriver.php line 113:
An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

In PDOConnection.php line 50:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

In PDOConnection.php line 46:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

In PDOConnection.php line 46:
PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known

PDOConnection.php

class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
    public function __construct($dsn, $user = null, $password = null, array $options = null)
    {
        try {
            parent::__construct($dsn, $user, $password, $options); // line 46
            $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
            $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (\PDOException $exception) {
            throw new PDOException($exception);
        }
    }

Add var_dump($dsn, $user, $password); at beginning of line 46

string(30) “mysql:host=db;charset=utf8mb4;”
string(4) “root”
string(10) “ezplatform”

I don’t understand where the problem may come from.

I tried:

  • ez down
  • ez update
  • ez build
  • ez up

and other things like that.

Finally I can’t connect to the database on command line.

ez enter
mysql -uroot -pezplatform -hdb

ERROR 2005 (HY000): Unknown MySQL server host ‘db’ (-2)


#2

relim ~/myproject $ ez docker:status

Docker Network
==============

              Name                             Command               State                       Ports                    
--------------------------------------------------------------------------------------------------------------------------
default-ezlaunchpad_adminer_1       entrypoint.sh docker-php-e ...   Up       0.0.0.0:42084->8080/tcp                     
default-ezlaunchpad_blackfire_1     blackfire-agent                  Exit 1                                               
default-ezlaunchpad_db_1            docker-entrypoint.sh mysqld      Up       0.0.0.0:42306->3306/tcp                     
default-ezlaunchpad_engine_1        /entrypoint.bash php-fpm         Up       9000/tcp                                    
default-ezlaunchpad_mailcatcher_1   mailcatcher --no-quit --fo ...   Up       1025/tcp, 0.0.0.0:42180->1080/tcp           
default-ezlaunchpad_nginx_1         /entrypoint.bash                 Up       0.0.0.0:42080->80/tcp, 0.0.0.0:42081->81/tcp
default-ezlaunchpad_redis_1         docker-entrypoint.sh redis ...   Up       6379/tcp                                    
default-ezlaunchpad_redisadmin_1    /usr/bin/dumb-init -- /red ...   Up       0.0.0.0:42083->8081/tcp                     
default-ezlaunchpad_solr_1          /entrypoint.bash                 Up       0.0.0.0:42983->8983/tcp                     
default-ezlaunchpad_varnish_1       /start.bash                      Up       6082/tcp, 0.0.0.0:42082->80/tcp             

#3

So @Plopix, maybe you can provide some help here? Thanks :slight_smile: