首页 文章

用于Apache cgi脚本的LD_LIBRARY_PATH

提问于
浏览
3

我用C构建了一个.CGI . 此二进制文件取决于特定文件夹 /usr/local/boost/ 中的某些 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:

在我的配置中,我在配置文件的末尾设置了这一行"as it is",而没有包含在任何 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>

我也尝试过(请参阅下面的discurrion)为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

我正在使用Red Hat 6.2 .

1 回答

  • 3

    在我们的Linux Debian框中,我们使用:

    创建一个配置文件,在其中添加字符串/ usr / local / boost:

    /etc/ld.so.conf.d/boost.conf
    

    然后运行:

    # ldconfig
    

    最后:

    # /etc/init.d/apache2 restart
    

    我不知道如何在Red Hat中做到这一点 .

相关问题