cgi

CGI、FastCGI和php-fpm的区别

无人久伴 提交于 2020-01-11 05:09:01
参考网上的描述,将网上的描述内容,整理进来: 首先,CGI是干嘛的?CGI是为了保证web server传递过来的数据是标准格式的,方便CGI程序的编写者。 web server(比如说nginx)只是内容的分发者。比如,如果请求/index.html,那么web server会去文件系统中找到这个文件,发送给浏览器,这里分发的是静态数据。好了,如果现在请求的是/index.php,根据配置文件,nginx知道这个不是静态文件,需要去找PHP解析器来处理,那么他会把这个请求简单处理后交给PHP解析器。Nginx会传哪些数据给PHP解析器呢?url要有吧,查询字符串也得有吧,POST数据也要有,HTTP header不能少吧,好的,CGI就是规定要传哪些数据、以什么样的格式传递给后方处理这个请求的协议。仔细想想,你在PHP代码中使用的用户从哪里来的。 当web server收到/index.php这个请求后,会启动对应的CGI程序,这里就是PHP的解析器。接下来PHP解析器会解析php.ini文件,初始化执行环境,然后处理请求,再以规定CGI规定的格式返回处理后的结果,退出进程。web server再把结果返回给浏览器。 好了,CGI是个协议,跟进程什么的没关系。那fastcgi又是什么呢?Fastcgi是用来提高CGI程序性能的。 提高性能,那么CGI程序的性能问题在哪呢?

How can I get the entire request body with CGI.pm?

这一生的挚爱 提交于 2020-01-10 02:31:24
问题 I'm trying to write a Perl CGI script to handle XML-RPC requests, in which an XML document is sent as the body of an HTTP POST request. The CGI.pm module does a great job at extracting named params from an HTTP request, but I can't figure out how to make it give me the entire HTTP request body (i.e. the XML document in the XML-RPC request I'm handling). If not CGI.pm, is there another module that would be able to parse this information out of the request? I'd prefer not to have to extract

架构师成长直通车

邮差的信 提交于 2020-01-10 01:41:55
一. 前言 本片文章面向后端开发,讲述后端在进行开发时所使用的WEB服务器的工作流程,正所谓知根知底,WEB服务器是后端开发人员日常用于调试WEB程序和与前端通讯的一种方式! WEB服务器最为强大的地方是能够执行WEB程序,其WEB程序的编程语言并没有明确的规定,因为只要你所使用的服务器支持这样的程序就可以了! WEB服务器更像是一个平台,在此平台上编写软件我们称其为WEB编程,注:WEB编程下有许多规范比如CGI,FastCGI等等,这个是要看服务器的支持范围! 不同服务器所使用的规范不同,比如JSP服务器只能运行由JAVA EE编写的WEB程序,不能用于运行像C/C++、Python等编程语言编写而成的WEB程序! 通常情况下的WEB服务器所使用的编程规范均为CGI编程、只能运行CGI规范的程序,除了一些例外的WEB服务器,比如JSP服务器! 二. CGI规范,WEB服务器执行过程 什么是CGI规范? CGI是Common Gateway Interface的缩写,其意义为公用网关接口,意思可以理解为:在WEB服务器上运行一个程序或脚本,并且WEB服务器要将脚本执行结果返回给浏览器(客户端)! 规范从何而谈? 规范的意思是,无论你使用任何语言编写,都必须使用输出函数(cout,printf,print)输出HTML格式的数据信息,WEB服务器根据这些信息传递给浏览器

How do I configure Apache 2 to run Perl CGI scripts?

微笑、不失礼 提交于 2020-01-08 16:03:06
问题 I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work. What is the right way of achieving this? 回答1: This post is intended to rescue the people who are suffering from *not being able to properly setup Apache2 for Perl on Ubuntu. (The system configurations specific to your Linux machine will be mentioned within square brackets, like [this]). Possible outcome of an improperly setup

php-fpm运行原理

做~自己de王妃 提交于 2020-01-07 02:14:44
来源: https://blog.csdn.net/sinat_38804294/article/details/94393621 一、php-fpm由来 1.cgi (common gateway interface 公共网关接口)是一种协议,也是一种程序 它是为了保证web server传递过来的数据是标准格式,方便cgi程序的编写者。 web server网站服务器只是内容的分发者(比如nginx)。如果请求/index.html,那么nginx会去文件系统中找到这个文件,发送给浏览器。这里分发的是静态数据。如果请求/index.php,根据配置文件,nginx知道这不是一个静态文件,需要去找php解析器来处理,那么nginx就会把这个请求简单处理交给php解析器。但是nginx传递给php解析器什么呢?url、查询字符串、post数据、header?这时候cgi就出来了,cgi就是规定了要传那些数据并以什么格式传递给后方处理这个请求的协议。 当web server 收到/index.php请求后,会启动对应的cgi程序,这里就是php的解析器。接下来php解析器会解析php.ini文件,初始化执行环境,然后处理请求,再以cgi规定的格式返回处理后的结果,退出进程。web server再把结果返回给浏览器。 2.fastcgi用来提高cgi程序性能的 cgi是个协议

Issue with filepath name, possible corrupt characters

为君一笑 提交于 2020-01-06 18:04:35
问题 Perl and html, CGI on Linux. Issue with file path name, being passed in a form field, to a CGI on server. The issue is with the Linux file path, not the PC side. I am using 2 programs, 1) program written years ago, dynamic html generated in a perl program, and presented to the user as a form. I modified by inserting the needed code to allow a the user to select a file from their PC, to be placed on the Linux machine. Because this program already knew the filepath, needed on the linux side, I

Ruby cgi needs to reload apache for new value?

徘徊边缘 提交于 2020-01-06 18:03:57
问题 I have phusion-passenger installed with apache on Ubuntu. In my config.ru, I have the following code: require 'cgi' $tpl = CGI.new['myvar'] + '.rb' app = proc do |env| [200, { "Content-Type" => "text/html" }, [$tpl]] end run app So then when I go to my browser at http://localhost/?myvar=hello , I see the word hello printed out, which is fine. Then I change the url to http://localhost/?myvar=world , but the page still shows hello . Only after I reload apache will the page show world . Before

Ruby cgi needs to reload apache for new value?

微笑、不失礼 提交于 2020-01-06 18:03:24
问题 I have phusion-passenger installed with apache on Ubuntu. In my config.ru, I have the following code: require 'cgi' $tpl = CGI.new['myvar'] + '.rb' app = proc do |env| [200, { "Content-Type" => "text/html" }, [$tpl]] end run app So then when I go to my browser at http://localhost/?myvar=hello , I see the word hello printed out, which is fine. Then I change the url to http://localhost/?myvar=world , but the page still shows hello . Only after I reload apache will the page show world . Before

Issue with filepath name, possible corrupt characters

自作多情 提交于 2020-01-06 18:03:23
问题 Perl and html, CGI on Linux. Issue with file path name, being passed in a form field, to a CGI on server. The issue is with the Linux file path, not the PC side. I am using 2 programs, 1) program written years ago, dynamic html generated in a perl program, and presented to the user as a form. I modified by inserting the needed code to allow a the user to select a file from their PC, to be placed on the Linux machine. Because this program already knew the filepath, needed on the linux side, I

CGI c file open

大憨熊 提交于 2020-01-06 07:44:11
问题 I have created a cgi file in c. I have an html file in which the user can select the file he/she wants to upload. The problem is that when I select the file, the value of the file is just the name of the file and not the directory so I cannot read the file. How should I access the file? <form action="./cgi-bin/paperload.cgi" method="get"> <pre>Title: <input type="text" name="title"><br></pre> <pre>Author: <input type="text" name="author"><br></pre> <pre>File: <input type="file" name="file">