Apache2在没有LD_LIBRARY_PATH的情况下启动

时间:2018-06-02 09:46:44

标签: linux apache

在Suse11上,我在用户env中设置了LD_LIBRARY_PATH。然后我开始apache2 apache2ctl start

但是我发现apache2进程没有继承LD_LIBRARY_PATH。 我需要指定任何标志吗?

1 个答案:

答案 0 :(得分:0)

抱歉,我忘了提一件事,我用sudo启动http服务器。我需要LD_LIBRARY_PATH,因为外部PHP模块依赖于一些libs来启动。我发现'sudo'命令消除了我的LD_LIBRARY_PATH。

   Note that the dynamic linker on most operating systems will remove variables that can control dynamic linking from the environment of setuid executables,
   including sudo.  Depending on the operating system this may include _RLD*, DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.  These type of variables are
   removed from the environment before sudo even begins execution and, as such, it is not possible for sudo to preserve them.

最后我用“sudo -E LD_LIBRARY_PATH = $ LD_LIBRARY_PATH apache2ctl start”启动http服务器来设置LD_LIBRARY_PATH。