linux - Apache2 在没有 LD_LIBRARY_PATH 的情况下启动
问题描述
在 Suse11 上,我在我的用户环境中设置了 LD_LIBRARY_PATH。然后我通过 apache2ctl start 启动 apache2
但我发现 LD_LIBRARY_PATH 不是由 apache2 进程继承的。我需要指定任何标志吗?
解决方案
抱歉我忘了提一件事,我使用 sudo 来启动 http 服务器。我需要 LD_LIBRARY_PATH 因为外部 PHP 模块依赖于一些库来启动。而且我发现“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。
推荐阅读
- java - 当我尝试在片段中显示或隐藏浮动操作按钮时出错
- python - 对列表字典进行排序
- google-cloud-platform - 如何使用 JAVA 使用 REST API 从服务帐户凭据创建访问令牌?
- php - Laravel 块调用我的变量上的成员函数 groupBy()
- angular-cli - 我无法在 Angular 11 中启动 ng serve --open 命令
- gcc - 如何列出 .o 文件中定义的所有函数和静态变量以及 .o 文件引用的所有函数和静态变量?
- python - 比较来自不同数据帧的唯一值
- sql - Oracle查询基于另一列检索不同的和公共的列值
- redirect - IIS URL 重定向 - 多个匹配项 - 优先顺序
- nuget - 将 NuGet 还原与锁定文件一起使用会出现“NU1004:包锁定文件与项目依赖项不一致”错误