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.

  • Synchronizing numeric user id's between Dockerfiles and docker-compose.yml?
  • Slow docker push since Version 17.03.0-ce-mac2
  • Error: ./ts3server: not found
  • Commandline arguments in docker-compose
  • AWS Cloudwatch logs with Docker Container - NoCredentialProviders: no valid providers in chain
  • Is this a error of GitLab Documentation?
  • 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.

  • Building a Docker image with deprecated dependencies
  • Splash installation through Docker in OS X: read-only file system
  • Production vs Development Docker setup for Node (Express & Mongo) App
  • Docker bridge over IPSec - Connection reset by peer with Tomcat (but not Nginx)
  • Cannot connection Oracle Database after using Docker container
  • Docker alpine image's basic commands are not working
  • 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.