Error connecting to pdo_mysql when using Docker with apache and mysql

Asked

Viewed 167 times

1

I’m using Docker with apache 5.6 + mysql:

Mysql Oficial
Docker PHP Official
PHP - Version 5.6

I first 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 mysystem myserver/my-build-apache

So far so good, I can make connection using the mysqli_*.

However, the system uses the Pdo_mysql resource, using a configuration file: application.ini, it arrow the following information:

Resources.db.Adapter = "Pdo_mysql"

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

It turns out I’m having the following error to load the PDO socket:

Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[HY000] [2002] Can’t 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’t 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 the php.ini

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.