lighttpd不使全局环境变量可用于可执行的

时间:2021-11-04 12:12:53

How to set up lighttpd in order to make environment variables available to spawned processes?

如何设置lighttpd以使环境变量对衍生过程可用?

I have an executable being called through CGI as an URL (e.g. http://.../cgi-bin/executable.bin).

我有一个可执行程序通过CGI作为一个URL被调用(例如:http://../cgi -bin/executable.bin)。

The executable needs to load libraries and read environment variables that are set in /etc/profile using export FOO=BAR.

可执行文件需要使用export FOO=BAR加载在/etc/profile中设置的库和读取环境变量。

When I try to access the URL, it generates Internal Server Error (500), caused by an empty environment variable, which are properly set in /etc/profile.

当我尝试访问URL时,它会生成内部服务器错误(500),这是由一个空的环境变量引起的,该变量在/etc/ profilefile中正确设置。

1 个解决方案

#1


3  

I ended up enabling mod_setenv in modules.conf and including each environment variable I needed like this:

最后我在模块中启用了mod_setenv。包括我需要的每个环境变量:

##
## mod_setenv
##
setenv.add-environment = ( "PATH" => env.PATH,
                           "WSFC_HOME" => env.WSFC_HOME,
                           "LD_LIBRARY_PATH" => env.LD_LIBRARY_PATH )

#1


3  

I ended up enabling mod_setenv in modules.conf and including each environment variable I needed like this:

最后我在模块中启用了mod_setenv。包括我需要的每个环境变量:

##
## mod_setenv
##
setenv.add-environment = ( "PATH" => env.PATH,
                           "WSFC_HOME" => env.WSFC_HOME,
                           "LD_LIBRARY_PATH" => env.LD_LIBRARY_PATH )