Table of Contents
回复内容:
Home Backend Development PHP Tutorial php和cgi之间的区别?

php和cgi之间的区别?

Jun 06, 2016 pm 04:44 PM
cgi php

php的结构很像是网络服务器接收到一个请求,然后调用php这个程序处理php的脚本,和cgi的性质一样,但是为什么,很多人都把cgi作为一个过时的技术,或者说,将php视作与cgi截然不同的一种结构呢?
他们之间是不是真的有什么本质上的区别呢?

回复内容:

额,首先CGI是外部应用程序与Web服务器之间的接口标准,不同类型语言写的程序只要符合cgi标准,就能作为一个cgi程序与web服务器交互,早期的cgi大多都是c或c++。php可以作为一个cgi使用,作为cgi时,它将作为独立的进程运行,有请求过来就创建一个进程进行响应。当php作为apache的一个模块时,php将作为apache的一个子进程存在,接受apache调用。现在也有了php-fpm+nginx的组合,php-fpm是一个fast-cgi管理器,负责将接收到的请求分配给预先生成的php子程序,管理着php进程。 PHP(Hypertext Preprocessor,超文本预处理器)是一门编程语言,主要用于服务器端的动态页面生成和数据库操作,CGI是它的诸多应用之一。

CGI(Common Gateway Interface,通用网关接口)是一种常见的技术,比如我在回答这个问题,点击“提交”之后,这段文本便被浏览器传递到知乎的服务器CGI程序,经过处理之后,别人再打开这个页面就能看到我的回答了。
CGI在服务器端可以用很多语言实现,比如PHP、Python、C/C++、JAVA等等等等。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles