Tag: php

Docker fails to install php mysql extension

I’m just trying to get a simple docker dev environment setup, but docker is not installing php‘s mysql extension. I get a fatal error – Call to undefined function mysql_connect(). I’ve tried different php versions (5.4, 5.5, 5.6, 7.0) all with the same result. Any help would be appreciated. docker-compose.yml version: ‘2’ volumes: database_data: driver: […]

Nginx proxy pass real ip doesn't work

I run a nginx reverse proxy server in the docker container. And the backend is a apache server running on the host, which is listening 10082 port. Laravel handle the request. And I use $request->getClientIp() to get real ip. However, the result of visiting the server by http://myip:10082 directly without proxy conflicts with the result […]

How to stop the client IP address getting lost in a Cloudflare/Docker/NGINX/LAMP site?

The problem is the PHP field $_SERVER[‘HTTP_CLIENT_IP’] is not being set in my following site structure, how should I correct this? Static IP containers on a Docker bridge network (on a host behind cloudflare) named ‘back’: NGINX running in container (172.24.02) Apache + PHP in container ( nginx.conf: location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header […]

prepend command with env variable – including sub command

I need to add an environment variable to the php artisan migrate commands of Laravel for use with docker, like: env DB_HOST= php artisan migrate I created a function in my .zshrc file like this: function migrate() { (env DB_HOST= php artisan migrate $*) } however the way Laravel’s command structure works is like this: […]

Behat Mink file upload not finding file on submit

I’m trying to test an image upload using Selenium/Mink with Behat in a Symfony application. The application is running in a Docker container. I’m attaching the file directly to the NodeElement of the input rather than use $driver->attachFileToField(‘#id-of-input’, $filePath) because we’re dealing with a lot of inputs in the context and already have the input […]

Missing js/css files in frontend of contao cms

i was making a local copy of a working live instance of a contao website (contao version 3.4.0). i copied web folder and made a dump of database. the site works on local in general but several files (e.g. slider js/css) are missing with following error in console: “Failed to load resource: the server responded […]

How can I keep docker container alive long enough for New Relic send traced exceptions?

We are running a php cli command in a docker container with New Relic deamon installed to track exceptions. The problem is that New Relic sends exception traces on an interval of 1 minute, but when our php process crashes due to an exception, the container gets killed right away. Is there a (simple) solution […]

NGINX + PHP-FPM – Should I keep them in separate containers or not?

This question is more about convention really. Currently I have two containers, one for NGINX (using the NGINX maintained image) and one for my application which is a custom image but has PHP-FPM running on it. They currently communicate using Port Forwarding and it’s working just fine. Recently I was asked that since both of […]

“Hello World” with official nginx and php docker images. Howto?

I want to run some simple index.php file, using official nginx and php docker images. These are my prerequisites: ubuntu version is 16.04.1 LTS (my host machine) docker version is 1.12.6 docker-compose version 1.9.0 My local directory on my host machine looks like so: \code index.php docker-compose.yml nginx.conf index.php contains some simple code: <?php echo […]

Gitlab CI: Persist MySQL data between stages

How do I persist MySQL data between different build stages? I have MySQL set up as a service however, when going from a build to a deploy stage the MySQL database is empty and I’m unable to find any information on this. Example gitlab-ci.yml: image: php:latest services: – mysql:5.6 stages: – build – deploy build: […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.