在Apache中2.4.6和的mod

编程入门 行业动态 更新时间:2024-10-18 14:15:22
本文介绍了在Apache中2.4.6和的mod_fastcgi FastCGI的脚本不能找到libfcgi.so.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我简单的hello世界FastCGI的脚本用C写的。

This is my simple hello-world FastCGI script written in C.

#include "fcgi_stdio.h" #include <stdlib.h> void main(void) { int count = 0; while(FCGI_Accept() >= 0) printf("Content-type: text/html\r\n" "\r\n" "<title>FastCGI Hello!</title>" "<h1>FastCGI Hello!</h1>" "Request number %d running on host <i>%s</i>\n", ++count, getenv("SERVER_NAME")); }

如果我使用静态链接编译它,它工​​作正常。

It works fine if I compiled it using static linking.

gcc -o "test.fcg" "test.c" /usr/local/lib/libfcgi.a

但使用动态链接时...

But when using dynamic linking...

gcc -o "test.fcg" -lfcgi "test.c"

它没有蒙山以下错误Apache的 error_log中。

/var/www/fcgi-bin/test.fcg: error while loading shared libraries: libfcgi.so.0: cannot open shared object file: No such file or directory [Thu Mar 05 14:04:22.707096 2015] [:warn] [pid 6544] FastCGI: (dynamic) server "/var/www/fcgi-bin/test.fcg" (pid 6967) terminated by calling exit with status '127' [Thu Mar 05 14:04:22.707527 2015] [:warn] [pid 6544] FastCGI: (dynamic) server "/var/www/fcgi-bin/test.fcg" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds

所以我告诉Apache和的mod_fastcgi寻找它位于哪里设置 LD_LIBRARY_PATH 变量的httpd.conf ...

SetEnv LD_LIBRARY_PATH /usr/local/lib

...和 fastcgi.conf 。

FastCgiConfig -initial-env LD_LIBRARY_PATH=/usr/local/lib -idle-timeout 20 -maxClassProcesses 1

使用静态链接的脚本, GETENV(LD_LIBRARY_PATH)收益的/ usr / local / lib目录,但动态链接脚本仍然不抛发现错误的 libfcgi.so.0 。

Using a static-linked script, getenv("LD_LIBRARY_PATH") returns /usr/local/lib, but dynamic-linked scripts are still throwing not found errors for libfcgi.so.0.

任何想法,使这项工作?

Any ideas to make this work?

先谢谢了。

推荐答案

我和nginx的类似的问题,我用 rpath的选项固定它。

I had similar issue with nginx, I fixed it by using rpath option.

不知道它会与Apache的帮助。尝试建立您的二进制文件是这样的:

Not sure if it will help with Apache. Try building your binary like this:

gcc test.c -Wl,-rpath /usr/local/lib -lfcgi -o test.fcg

请确保该库文件 libfcgi.so.0 是present在的/ usr / local / lib目录。

Make sure the library file libfcgi.so.0 is present at /usr/local/lib.

如果你没有访问的/ usr / local / lib目录,然后创建了 LIB 文件夹你的 $ HOME ,和那里复制库文件。并更新 rpath的指向那里。例如,如果你的 $ HOME 是 /家庭/ XYZ ,那么你会像建:

If you don't have access to /usr/local/lib, then create the lib folder in your $HOME, and copy the library file there. And update the rpath to point to there. For example, if your $HOME is /home/xyz, then you would build like:

gcc test.c -Wl,-rpath /home/xyz/lib -lfcgi -o test.fcg

有时我用这种伎俩来加载新的库比什么是安装在系统上。

Sometimes I use this trick to load newer libraries than what is installed on the system.

更多推荐

在Apache中2.4.6和的mod

本文发布于:2023-11-01 02:03:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Apache   mod

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!