我用 C++ 构建了一个 .CGI。此二进制文件依赖于boost特定文件夹中的某些共享库和其他资源/usr/local/boost/。CGI 不执行,在日志中我可以看到错误
    error while loading shared libraries: libdxxx: cannot 
    open shared object file: No such file or dire
现在,我已经阅读了许多日志,说我必须在httpd.conf下面进行设置,但仍然无法正常工作。
   SetEnv LD_LIBRARY_PATH /usr/local/boost:
在我的配置中,我将这一行设置为“原样”在配置文件的末尾,而不包含在任何VirtualHOst or Directory部分中。我试图插入 cgi-bin 的目录但仍然相同
 <Directory "/var/www/cgi-bin">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
     SetEnv LD_LIBRARY_PATH /usr/local/boost
 </Directory>
我也尝试过(参见下面的讨论)为 ldconfig 添加一个 .conf 文件,但它仍然不起作用!
  #added a file called myconfig.conf conrtaining a line
  /usr/local/boost 
  /etc/ld.conf.d/
  ldconfig (as root)
我还读取了httpd继承运行它的 ROOT 用户的环境变量;当我 root 时,我调用以下命令来启动 Apache,并且 LD_LIBRARY_PATH 设置正确,但仍然有问题。
 /etc/init.d/httpd start
我正在使用红帽 6.2。