What are CGI scripts used for these days?

前端 未结 10 2017
一个人的身影
一个人的身影 2021-02-02 11:38

I\'m pretty well up to speed on general web programming languages, but one of the tools I\'m working with right now is in CGI. All I can tell is that CGI scripts are quite slow.

相关标签:
10条回答
  • 2021-02-02 12:35

    I know of 2 projects that are being actively being developed that still use CGI scripts to good effect.

    The first is Webmin a web-based system administration tool that I've been using for years.

    The second is GitWeb which allows you to setup a web interface to your Git repositories.

    As to the speed of CGI (or lack thereof) I can't really comment on that. From my experience with Webmin I can't say I've had any issues on that front.

    0 讨论(0)
  • 2021-02-02 12:36

    CGI is protocol, it is most basic and most standard way to create dynamic pages.

    There are many cases where it is useful:

    1. When you want to create, a basic application in a language without mod_XYZ, let's say C or Haskell, that may be computation intensive.
    2. In embedded systems, where memory is expensive and you prefer to spawn a CGI script rather then holding it in memory all the time.
    3. On some hosting services where you want to give flexibility to write server side software in any technology you want, but on the other hand do not hold president applications in memory using FastCGI (for example Sourceforge hosting).
    4. The loads on CGIs are low so you don't care about spawning applications per request. For example, in blogs like MoveableType, only updates are done via CGI, all the rest is served via static pages, which CGI script changes when needed. So the cost of spawning CGI script is very low.
    5. When most of your content is static pages and you want to serve it with server like thttpd, so very few operations that are done can be done via CGI that it supports.

    So... CGI is simple but still very useful API, allowing to do stuff simply.

    For example, the script that shows uptime of your server

    #!/bin/bash
    echo Content-Type: text/plain
    echo
    uptime
    

    What can be simpler, easier and less web-server dependent?

    0 讨论(0)
  • 2021-02-02 12:36

    Real time operating systems where porting (for example, PHP) is not an option.

    0 讨论(0)
  • 2021-02-02 12:38

    Many shared hosts serve server side languages like PHP, python and perl through CGI

    0 讨论(0)
提交回复
热议问题