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 3…
Tag: docker
Running virtual hosts in apache docker container
I have two php applications in the same apache container and I’m trying to run one of them on a port since it needs to be accessible via a root domain and not a subfolder. I want to run the …
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 / HT…
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. …
Codeigniter mysql can’t connect in docker
Codeigniter 3.0 can not connect to local mysql, so please let me know the reason. Error message is SQLSTATE [HY000] [2002] Connection refused. My Codeigniter is working on Docker. Specifically on …
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/…
Send email on testing docker container with php and sendmail
I’m on ubuntu 16.04. I have a (testing) docker (docker-compose) container running php 5.6 and apache 2.4. On the production platform (without docker) the mail is sent with sendmail. How to send test …
PHP 7.1 on Docker PDO Driver not installed – Verified it is on the image
I am always getting an error that PDO driver not found. I tried restarting, installing PDO extensions directly. Note that this docker setup works on my Linux box last night. Only difference is I did it from scratch compared to on my Windows box I already has images. After getting the error initially I tried t…
Symfony logs to stdout inside Docker container
I’m building a docker image for a Symfony application. In this image, I want to stream the Symfony logs to stdout. So, similar to how nginx logs are configured, I added this line to my Dockerfile: ln …
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. Answ…