Error connecting to pdo_mysql when using docker with apache and mysql

1

I'm using docker with apache 5.6 + mysql:

MySQL Official
Docker PHP Official
PHP - Version 5.6

First I ran the mysql image, then ran the following command line to run the apache image, linking the two:

  

docker run -d -p 80:80 --expose 9000 -v $ {PWD} / myproject: / var / www / html --link mydb: mysql --name myserver myserver / my-build-apache

p>

So far so good, I can connect using mysqli_* .

However, the system uses the resource in PDO_Mysql, using a configuration file: application.ini, it points to the following information:

  

resources.db.adapter="PDO_Mysql"

This file is loading on a system made in Zend Framework 1.12.20

I'm having the following error to load the PDO socket:

  

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE [HY000] [2002] Can not connect to local MySQL server through socket' /var/run/mysqld/mysqld.sock '(2)' in / var /www/html/webapp/pro/library/Zend/Controller/Plugin/Broker.php on line 336

     

(!) PDOException: SQLSTATE [HY000] [2002] Can not connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in / var / www / html / webapp / pro / library / Zend / Db / Adapter / Pdo / Abstract.php on line 129

This is php.ini

    
asked by anonymous 03.01.2017 / 12:42

0 answers