Developing CGI programs in C language

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.