1 Download Apache program Apache Link: http://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.21-win32-x86-no_ssl.msi
2 Procedures:
#include <stdio.h>
int main (int argc,char*argv[]) {
printf ("content-type:text/html\n\n");//Note: there must be 2 \ n
printf ("Hello World");
return 0;
}
Generate 001.exe to put this file into the Cgi-bin directory
3 Apache Configuration profile (conf/httpd.conf)
Find #AddHandler cgi-script. CGI to AddHandler cgi-script. CGI. exe
(Remove the previous # and add the. exe after it)
4 Restart Apache Enter Http://127.0.0.1/cgi-bin/001.exe in the browser
Advanced: Transfer the Cgi-bin directory to the Htdocs directory
1 Change all Cgi-bin in the directory pointed to by Cgi-bin in the configuration file to Htdocs
2 found
<directory "E:/apache2/apache2/cgi-bin" >
AllowOverride None
Options None
Order Allow,deny
Allow from all
</Directory>
Change options None to options execcgi and restart Apache
3 Put 001.exe into Htdocs
4 Enter Http://127.0.0.1/001.exe in the browser
Developing CGI programs in C language