zoukankan      html  css  js  c++  java
  • ubuntu下使用C语言开发一个cgi程序

    主要步骤是:

    1. 开发一个C程序(在标准输出中输出HTML字符串)

    2. 复制到apache2的cgi-bin目录去

    3. 在httpd.conf中开启cgi功能(我似乎没用到,也可以使用cgi)


    ubuntu上apache的cgi-bin目录上 是/usr/lib/cgi-bin

    gcc -o hello hello.c
    cp hello /usr/lib/cgi-bin

    hello.c

    #include <stdio.h> 
    
    int main() 
    { 
        printf("Content-type:text/html
    
    "); 
        printf("<html>
    "); 
        printf("<head><title>welcome to c cgi.</title></head>
    <body>"); 
        printf("hello,world!"); 
        printf("</body></html>
    "); 
    
        return 0;
    } 
  • 相关阅读:
    js原型杂谈
    arguments.callee.caller
    $resource
    sql的四种匹配模式
    AMD规范
    module.ngdoc
    angularjs杂谈
    浏览器前缀
    css21规范学习
    <meta>标签
  • 原文地址:https://www.cnblogs.com/code-style/p/3565252.html
Copyright © 2011-2022 走看看