什么是CGI模式?

发布于 2024-07-14 01:21:02 字数 115 浏览 5 评论 0原文

当我们说应用程序可以在 CGI 模式下运行时,这意味着什么? 我正在 cmsmatrix.org 上查看各种 CMS 系统的功能,“CGI 模式支持”被列为一项功能。 Web 应用程序还可以运行哪些其他“模式”?

What does it mean when we say an application can run in CGI mode? I was reviewing the features of various CMS systems on cmsmatrix.org and "CGI mode support" was listed as a feature. What are the other "modes" in which a web application can run?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

末蓝 2024-07-21 01:21:02

基本上,CGI 意味着网络服务器将执行外部进程,获取其结果(生成的 HTML 页面、图像……)并将其发送回客户端。

这有一个主要缺点,因为它每次需要时都会启动外部进程,因此这可能是一个很大的开销。

您还可以使用 FastCGI 启动外部进程一次,并在需要时重用它。

但通常,语言直接集成在网络服务器中。
例如,Apache有一个mod_perl模块来执行perl脚本,而不是通过CGI执行perl脚本

Basically, CGI implies that the webserver will execute an external process, get its result (a generated HTML page, an image, ...) and send it back to the client.

This has major drawbacks because it launchs the external process each time it is needed, so this can be a big overhead.

You have also FastCGI that launch the external process once, and reuses it when needed.

But usually, languages are integrated directly in the webserver.
For example, Apache has a mod_perl module to execute perl scripts, instead of executing perl scripts via CGI

波浪屿的海角声 2024-07-21 01:21:02

CGI 代表“通用网关接口”,它是一种旧的 Web 应用程序架构。 CGI 的工作原理是放置来自 HTTP 请求的变量并 fork/exec()ing CGI 进程。 它在 Web 开发的早期很受欢迎,因为它在 Unix 主机上运行良好。 Perl/CGI 是这个时代流行的架构,它对 Perl 作为一种语言的流行做出了巨大贡献。

CGI 的主要特点是它不需要太多的管道,因此它可以与大多数 Web 服务器一起工作。 主要缺点是 fork-exec 过程很慢,因为必须启动 CGI 脚本(这可能涉及启动 perl 或其他解释器)。 在 Windows 上,生成新进程比 unix 慢得多,因此 CGI 效率更低。

CGI stands for 'Common Gateway Interface', which is an old architecture for web applications. CGI works by placing the variables from the HTTP request and fork/exec()ing the CGI process. It gained popularity in the early days of web development as it worked well on a unix host. Perl/CGI was a popular architecture in this era and it contributed substantially to the popularity of Perl as a language.

The main claim to fame of CGI is that it doesn't require much plumbing, so it will work with most web servers. The main drawback is that the fork-exec process is slow-ish as the CGI script has to be started (which may involve starting a perl or other interpreter). On Windows, spawning a new process is much slower than unix, so CGI is even more inefficient.

迷途知返 2024-07-21 01:21:02

CGI 是 Web 服务器用来调用服务器上的可执行文件的协议。 收到请求后,它将有关请求的信息发送到 cgi 脚本,并将该脚本的结果返回给浏览器。

替代方案是 fastcgi。 这意味着 Web 服务器不会联系脚本来应答请求,而是联系进程。 不过,通信协议仍然相同(因此得名)。

CGI is a protocol that is used by web servers to call executable files on the server. Upon receiving a request, it sends the information about the request to the cgi script and returns the result of that script back to the browser.

An alternative to that is fastcgi. This means, that the web server does not contact a script to answer the request, but a process. The communication protocol is still the same, though (hence the name).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文