How to set PHP $_SERVER variable with Docker?

Viewed 5135

I've created a PHP/Apache/MySQL development environment with Docker and would like to set variable that I can use with $_SERVER in PHP.

Usually I will configure something like that in my virtual host

SetEnv ENV "developement"

Is there a way to do it with my docker_compose.yml file ? I'll try by using environment: - ENV=developement in my docker-compose file but it doesn't work.

Here is my Dockerfile

FROM php:5.6-apache

RUN apt-get update -y && apt-get install -y libpng-dev curl libcurl4-openssl-dev

RUN docker-php-ext-install pdo pdo_mysql gd curl

RUN a2enmod rewrite

RUN service apache2 restart

and my docker-compose.yml

version: '2'

services:
  webserver:
    build: ./docker/webserver
    image: dev_web
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /pathtodev/www:/var/www/html
    links:
      - db
    environment:
     - ENV=developement

  db:
    image: mysql:5.7
    ports: 
      - "3306:3306"
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=******
      - MYSQL_DATABASE=db_dev
2 Answers
Related