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.

  • How to check if a process is running inside docker container
  • Error when Dockerizing a sails app with docker-toolbox
  • Inserting a conditional RUN statement inside a dockerfile
  • Docker for parallel tasks
  • Does the Docker RPM require additional dependencies?
  • Correct way to change tcp_keepalives settings in postgres docker container
  • 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 version fails on OS X
  • Docker and UFS filesystem
  • docker apt-get multiple gets (can it be reduced?)
  • Why won't my docker-cmd execute with sh?
  • pull all docker images in saltstack
  • Trying to create postgis inside docker file gives the error
  • 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.