cgi

Is it possible to send POST parameters to a CGI script without another HTTP request?

大憨熊 提交于 2020-01-06 05:23:10
问题 I'm attempting to run a CGI script in the current environment from another Perl module. All works well using standard systems calls for GET requests. POST is fine too, until the parameter list gets too long, then they get cut off. Has anyone ran in to this problem, or have any suggestions for other ways to attempt this? The following are somewhat simplified for clarity. There is more error checking, etc. For GET requests and POST requests w/o parameters , I do the following: # $query is a CGI

Is it possible to run a batch file as a cgi in apache under windows?

随声附和 提交于 2020-01-05 19:20:57
问题 This sounds incredibly simple to do, but I can't make it work. I have it working with awk and perl, but cmd.exe wasn't designed to be a cgi program so no matter what I do, I either get the browser downloading the file, internal server error, or I get the path of the current directory as the first line. You HAVE to put a #! in the first line of a cgi, or you get an internal server error, but I end up with C:\Program Files (x86)\Apache Software Foundation\Apache2.2\cgi-bin>#!c:\windows\system32

Is it possible to run a batch file as a cgi in apache under windows?

不打扰是莪最后的温柔 提交于 2020-01-05 19:20:10
问题 This sounds incredibly simple to do, but I can't make it work. I have it working with awk and perl, but cmd.exe wasn't designed to be a cgi program so no matter what I do, I either get the browser downloading the file, internal server error, or I get the path of the current directory as the first line. You HAVE to put a #! in the first line of a cgi, or you get an internal server error, but I end up with C:\Program Files (x86)\Apache Software Foundation\Apache2.2\cgi-bin>#!c:\windows\system32

CGI、FastCGI和php-fpm的区别

瘦欲@ 提交于 2020-01-05 10:09:21
参考网上的描述,将网上的描述内容,整理进来: 首先,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程序的性能问题在哪呢?

CGI、FastCGI和PHP-FPM关系详解

馋奶兔 提交于 2020-01-05 08:36:25
在搭建 LAMP/LNMP 服务器时,会经常遇到 PHP-FPM、FastCGI和CGI 这几个概念。如果对它们 一知半解 ,很难搭建出高性能的服务器。接下来我们就以图形方式,解释这些概念之间的关系。 基础 在整个网站架构中,Web Server(如Apache)只是内容的分发者。举个栗子,如果客户端请求的是 index.html,那么Web Server会去文件系统中找到这个文件,发送给浏览器,这里分发的是静态数据。 如果请求的是 index.php,根据配置文件,Web Server知道这个不是静态文件,需要去找 PHP 解析器来处理,那么他会把这个请求简单处理,然后交给PHP解析器。 当Web Server收到 index.php 这个请求后,会启动对应的 CGI 程序,这里就是PHP的解析器。接下来PHP解析器会解析php.ini文件,初始化执行环境,然后处理请求,再以规定CGI规定的格式返回处理后的结果,退出进程,Web server再把结果返回给浏览器。这就是一个完整的动态PHP Web访问流程,接下来再引出这些概念,就好理解多了, CGI:是 Web Server 与 Web Application 之间数据交换的一种协议。 FastCGI:同 CGI,是一种通信协议,但比 CGI 在效率上做了一些优化。同样,SCGI 协议与 FastCGI 类似。 PHP-CGI

FastCGI与PHP-FPM

筅森魡賤 提交于 2020-01-05 08:36:07
要想弄清FastCGI和PHP-FPM,就需要先弄清一些基本的概念: CGI FastCGI PHP-FPM PHP-CGI 。 CGI 通用网关接口,描述的服务器和请求处理程序之间的数据传输的一种标准。 这可以简单的理解为 CGI 就是保证 web server 传过来的数据是标准的,能够方便的请求处理程序的编写。 在这一层面之上, web server 只是请求内容的分发者。比如,如果请求 index.html ,那么 web server 会去文件系统中查找这个文件,然后发送到浏览器,那么这里分发的就是静态资源。如果这个时候请求的不是 index.html 而是 index.php 的话,根据 web server (比如 nginx )的配置文件, server 判断出此次请求的不是静态文件,而是一个PHP的程序,需要去找PHP解析器来处理,那么server会简单处理这个请求后交给PHP解析器。 Nginx 会将请求的 URL 、 GET/POST数据 、 HTTP Header 等协议规定好的数据传递到处理请求的 CGI程序 中。 让我们在具体一点的分析。当 server 收到 index.php 这个请求后, server 会启动对应的CGI程序,本文中指的就是PHP的解析器。接下来PHP解析器会解析配置文件 php.ini ,初始化运行环境,然后处理请求

nginx和php-fpm调用方式

≯℡__Kan透↙ 提交于 2020-01-05 08:35:55
nginx和php-fpm调用方式 一.背景: 在开发中碰到一个问题,项目以nginx+php-fpm形式访问交互,结果访问项目时报错如下图: 二.分析: 提示很明确嘛,去看error.log(在nginx.conf或者vhost里头配置的,找到你对应路径即可) 错误信息如下: 1 2 3 2017/09/18 10:46:21 [error] 3880#0: *92 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.33.10, server: local.helios.com, request: "GET /v1/room/detail.json HTTP/1.1" , upstream: "fastcgi://127.0.0.1:9000" , host: "local.helios.com" 或 1 2 3 2017 /09/18 14:30:42 [crit] 5375 #0: *43 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.33.10,

nginx fastcgi php-fpm的关系梳理

北慕城南 提交于 2020-01-05 08:35:31
CGI(Common Gateway Interface) CGI全称是“公共网关接口”(Common Gateway Interface),HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上。 CGI可以用任何一种语言编写,只要这种语言具有标准输入、输出和环境变量。如php,perl,tcl等。 FastCGI FastCGI像是一个常驻(long-live)型的CGI,它可以一直执行着,只要激活后,不会每次都要花费时间去fork一次(这是CGI最为人诟病的fork-and-execute 模式)。它还支持分布式的运算,即 FastCGI 程序可以在网站服务器以外的主机上执行并且接受来自其它网站服务器来的请求。 FastCGI是语言无关的、可伸缩架构的CGI开放扩展,其主要行为是将CGI解释器进程保持在内存中并因此获得较高的性能。众所周知,CGI解释器的反复加载是CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器调度,则可以提供良好的性能、伸缩性、Fail- Over特性等等。 PHP-FPM PHP-FPM是一个PHP FastCGI管理器,是只用于PHP的,可以在http://php-fpm.org/download下载。 PHP-FPM其实是PHP源代码的一个补丁

HTTP request dispatch from Web Server to a CGI/FastCGI process

情到浓时终转凉″ 提交于 2020-01-04 05:39:08
问题 To gain more understanding of how HTTP requests are handled in case of web apps, how does a web server like Apache, dispatch a request to one of its Virtual Hosts? What are the initial programs executed irrespective of the framework (Rails/PHP/Java)? I would appreciate if someone can list the steps taking example of Rails (as I know Rails). Thanks in advance! 回答1: Ah, couple of good rails specific articles that explain most of what I wanted wanted to know: http://railsguts.com/initialization

Getting the Named Anchor using ColdFusion

怎甘沉沦 提交于 2020-01-04 04:10:07
问题 How can I get the URL using ColdFusion? I tried the following but it did not return the Named Anchor. For example http://www.makeup.edu/test/#abc <cfdump var=#cgi#> 回答1: You can't, 'cause although it is in the URL, it is only meant for the client. It will not be sent to the server, therefore you can never find that in the CGI scope. 回答2: As Henry says, you can't get them with ColdFusion because they are never sent with the request. What you need to do is to pull them out with Javascript