Skip to content
Advertisement

Tag: docker

Can’t connect to database in docker-compose

This is my docker-compose.yaml The problem is that php container can’t connect to mysql. Although from host I can connect with mycli -h 127.0.0.1 -P 3306 -u root. But when I exec in php container and try it, get ‘Connection refused’ Answer Your mysql service binds mysql server’s port 3306 to 3306 of the host machine. Thus is it normal

Apache / PHP error_log location in Docker

My PHP script has an error. For example, this shows this on the screen: Warning: require(/var/www/foo.php): failed to open stream: Where can I find this in the logs? I tried docker logs containerName, but it only shows access logs. E.g., 192.168.2.1 – – [17/Mar/2019:10:00:00 +0000] “GET / HTTP/1.1” 200 505 “-” “Mozilla/5.0 (Windows NT 6.1; Win64; x64)… It doesn’t show

share env variables between 2 containers from docker-compose

In my docker-compose, I have 2 containers, php-container, and nginx container. For nginx container I defined env variable, is there a way to access that variable in php container in code? I want to access in php code the PLAYER_NAME variable Answer Nope, you cannot do that, containers are isolated by design. You have to define the env variable for

Docker PHP MySQL connection refused

I am trying to run a site using multiple container configuration – one for apache, second for mysql and third for myadmin. Everything starts fine, setup runs smooth but when I try to run a PHP application I get mysqli::__construct(): (HY000/2002): Connection refused in system/libraries/drivers/Database/Mysqli.php [54] error. It seems that there’s something wrong with the connection settings but I checked

Docker – How to disable PHP ext / modules

I am working on a PHP API and I would like to disable unused php Modules inside my PHP-FPM image, such as “sqlite3, pdo ..”. I am a docker beginner and I would like to know if is there anything similar to docker-php-ext-enable if not what is the best practice for disabling unused php modules. Answer Finally I found the

Advertisement