如何从 FastCGI C 获取环境变量启动期间的二进制文件
我有一个 FastCGI 应用程序,它在启动期间加载和处理大量数据。我希望它获得一些环境变量来确定其输入数据路径,但据我所知,到目前为止,环境指针 envp 随请求一起提供。
我想在第一个请求之前执行 getenv,直接在 FCGX_Init() 之后执行。是否可以?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,事实证明,lighttpd 的 -initial-env 对应项是lighttpd.conf 的 fastcgi.server 部分中的“bin-environment”数组。 getenv() 从执行一开始就可以访问那里定义的值。
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.