For more information, please see: http://www.16boke.com
by ZXY,QQ Group: 168424095
Configuration of httpd.conf in Apache
(1) scriptalias/cgi-bin/"D:/program files/apache Software foundation/apache2.2/cgi-bin/"
Instead: scriptalias/cgi-bin/"f:/app/cgi/"
(2) <directory "D:/program files/apache Software Foundation/apache2.2/cgi-bin" >
AllowOverride None
Options None
Order Allow,deny
Allow from all
</Directory>
To
<directory "f:/app/cgi" >
#SetHandler Fastcgi-script
#SetHandler Cgi-script
#SetHandler Fcgid-script
AllowOverride None
#Options None
Options +execcgi
Order Allow,deny
Allow from all
</Directory>
(3) Increase in the last side:
LoadModule Fcgid_module modules/mod_fcgid.so
<ifmodule mod_fcgid.c>
AddHandler Fcgid-script. fcgi
Socketpath/tmp/fcgid.sock
Timeout 1000
#Action php-fastcgi/cgi-bin/
#AddType application/x-httpd. fcgi
</IfModule>
It turns out that one of the fastcgi that really helps me online is:
#include "fcgi_stdio.h"
#include "Fcgiapp.h"
#include <stdlib.h>
#include <string.h>
int main () {
Fcgx_stream *in, *out, *err;
Fcgx_paramarray envp;
char* Request_method;
Char* content_length;
Char* query_string;
int Len;
Char buffer[1024];
while (Fcgx_accept (&in, &out, &err, &ENVP) >= 0) {
fcgx_fprintf (out, "content-type:text/html\r\n\r\n");
Request_method = Fcgx_getparam ("Request_method", ENVP);
if (strcmp (Request_method, "POST") = = 0) {
Content_length = Fcgx_getparam ("Content_length", ENVP);
if (content_length!= NULL) {
len = 0;
Len = Strtol (Content_length, NULL, 10);
if (len = = 0) {
fcgx_fprintf (out, "No data from Standard input.\n");
}else{
FCGX_GETSTR (buffer, 1024, in);
Buffer[len-1] = ' the ';
fcgx_fprintf (out, "%s\n", buffer);
}
}
}else if (strcmp (Request_method, "get") = = 0) {
Query_string = Fcgx_getparam ("query_string", ENVP);
fcgx_fprintf (out, "%s\n", query_string);
}
}
return 0;
}
Apache Configuration
Include and Lib for the fastcgi used
Httpd-2.2.19-win32-x86-openssl-0.9.8r.zip
Mod_fcgid.so
For more information, please see: http://www.16boke.com