C语言编写cgi程序hello world
2017-02-05 16:16
330 查看
安装apache服务器,配置httpd.conf文件如下:
# "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin" should be changed
to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
# Options None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .exe .pl .cgi //运行.exe/.pl/.cgi程序
Example:
#include "stdafx.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
printf("Content-Type:text/html; charset=gb2312;\n\n");//后面必须加两个回车
printf("<html>");
printf("<body>");
printf("hello world!");
printf("</body>");
printf("</html>");
return 0;
}
# "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin" should be changed
to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
# Options None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .exe .pl .cgi //运行.exe/.pl/.cgi程序
Example:
#include "stdafx.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
printf("Content-Type:text/html; charset=gb2312;\n\n");//后面必须加两个回车
printf("<html>");
printf("<body>");
printf("hello world!");
printf("</body>");
printf("</html>");
return 0;
}
相关文章推荐
- Dijkstra算法
- C++多线程程序设计
- 文件查看器(C语言)
- C++语言--数组-6.1----数组在内存中的分布、数组名和函数、枚举常量
- 从四个属性的角度来理解C语言的指针也许会更好理解
- 从四个属性的角度来理解C语言的指针也许会更好理解
- C++ Primer笔记(二)
- 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位
- C语言之基本数据类型
- 上楼梯问题
- C语言指针的总结
- C++如何设计一个不含指针的类 (Boolan笔记第一周)
- C++ std::unordered_multimap
- PAT甲级1076
- C++异常与析构函数及构造函数
- C++ std::unordered_map
- c++程序的运行
- C++预处理器的简单用法
- C和C++混合编译,extern"C"的用法
- 汉诺塔ix C语言