Search code examples
c++fastcgilighttpdgetenv

How to get environment variable from FastCGI C++ binary during startup


I have a FastCGI application that loads and processes a lot of data during its startup. And I want it to get some environment variable to determine its input data path, but as much as I understand so far, environment pointer envp comes with the request.

I want to do getenv before the very first request, say directly after FCGX_Init(). Is it possible?


Solution

  • Yeah, as it turnes out, the lighttpd's counterpart to -initial-env is "bin-environment" array in the fastcgi.server section of lighttpd.conf. The values defined there are accessible for getenv() from the very beginning of execution.