web(五)---spawn-fastcgi
一. spawn_fastcgi的安装、部署与配置.
fcgio.cpp: In destructor 'virtual fcgi_streambuf::~fcgi_streambuf()':
fcgio.cpp:50:14: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::overflow(int)':
fcgio.cpp:70:72: error: 'EOF' was not declared in this scope
fcgio.cpp:75:14: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::sync()':
fcgio.cpp:86:18: error: 'EOF' was not declared in this scope
fcgio.cpp:87:41: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::underflow()':
fcgio.cpp:113:35: error: 'EOF' was not declared in this scope
make[2]: *** [fcgio.lo] Error 1
make[2]: Leaving directory `/home/lucasysfeng/workspace/web/download/nginx_spawn_fcgi_install_package/fcgi-2.4.1-SNAP-0311112127/libfcgi'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lucasysfeng/workspace/web/download/nginx_spawn_fcgi_install_package/fcgi-2.4.1-SNAP-0311112127'
make: *** [all] Error 2
#include <fcgi_stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
int count = 0;
while (FCGI_Accept() >= 0) {
printf("Content-type: text/html\r\n"
"\r\n"
""
"FastCGI Hello!"
"Request number %d running on host%s "
"Process ID: %d\n", ++count, getenv("SERVER_NAME"), getpid());
}
return 0;
}
2. 编译.
g++ demo.cc -o demo -lfcgi
(3) 或者设置下面环境变量试试.
export LD_LIBRARY_PATH=/usr/local/lib
sudo ldconfig
fastcgi_pass 127.0.0.1:8088;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME fcgi$fastcgi_script_name;

浙公网安备 33010602011771号