Accessing system variables through HHVM

Problem: I want to access environment variables through HHVM that aren’t typically exposed to a default php setup

Context: I rely on a couple of system variables to provide dynamic configuration options to a Laravel4 project running in a Docker container. I want to connect to a mysql DB running in another docker container that exposes a random IP address on startup. This IP address is passed into the Laravel4 container using --link options for Docker and automatically exposed as a system variable in the Laravel-4 container.

  • Multiple docker images run from docker file
  • Docker install memcached
  • Why does docker-compose build not reflect my django code changes?
  • marking origin of logs in logstash
  • Issues running cron in Docker on different hosts
  • How permanently kill dockerd?
  • Previous approach: When using php-fpm, I could expose system variables created by Docker to php using the www.conf file like so, and then just use getenv(‘VAR_NAME’) to get the variable in my php code.

    However, with HHVM, I cannot figure out how to access a “non-standard” environment variable. There seems to be no equivalent to www.conf that I can locate. Has anyone attempted this before? Is it possible to access system variables that are external to PHP using HHVM? Is there something specific to HHVM’s configuration and I just can’t find it in the docs?

    Additional Info: I am behind Nginx here. I don’t think fastcgi-param directives will work in my case, but I may just be doing it wrong. If anyone has accomplished what I’m trying to do using fastcgi-params, I’m fine with that approach also.

  • Docker nginx can't connect to upstream gunicorn running in separate container
  • Can not exit from node app, when using docker
  • Docker error: exit status 255
  • docker elasticsearch container not forwarding port
  • Kubernetes PullImageError using Docker Hub with a private image
  • Docker Service updatedAt timestamp
  • One Solution collect form web for “Accessing system variables through HHVM”

    fastcgi_param should work the exact same way in HHVM (assuming you are using HHVM as a fastcgi server, which you should be).

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