cgi

LAMP 搭建,wordpress.xcache,powerdns及poweradmin

别等时光非礼了梦想. 提交于 2019-12-30 16:58:03
一,概念 CGI: CGI全称是通用网关接口(Common Gateway Interface),是外部应用程序与与服务器之间的接口标准,是在CGI程序和web服务器之间传递信息的规程 CGI是一段程序,运行在服务器上。 CGI可以用任意语言编写,主要这种语言具有标准输入、输出和环境变量 原理: 每当客户请求CGI的时候,WEB服务器就请求操作系统读取配置文件,生成一个新的解释器进程(如php-cgi.exe),当CGI进程完成当前任务结束后,web服务器就会杀死这个进程 FastCGI: 一个可伸缩地、高速地在HTTP server和动态脚本语言间通信的接口, 接口方式采用C/S结构,可以将HTTP服务器和脚本解析服务器分开,同时在脚本解析服务器上启动一个或者多个脚本解析守护进程。当HTTP服务器每次遇到动态程序时,可以将其直接交付给FastCGI进程来执行,然后将得到的结果返回给浏览器。这种方式可以让HTTP服务器专一地处理静态请求或者将动态脚本服务器的结果返回给客户端,这在很大程度上提高了整个应用系统的性能。 原理: Web Server启动时载入FastCGI进程管理器(IIS ISAPI或Apache Module) FastCGI进程管理器自身初始化,启动多个CGI解释器进程(可见多个php-cgi)并等待来自Web Server的连接。 当客户端请求到达Web

Python noob here: On a Python enabled web server, how do I use Python?

时光毁灭记忆、已成空白 提交于 2019-12-30 07:46:08
问题 #!/usr/bin/env python # -*- coding: UTF-8 -*- # enable debugging import cgitb cgitb.enable() print "Content-Type: text/plain;charset=utf-8" print print "Hello World!" My goal is to replace PHP with Python. I'm pretty good with PHP and I can use Python on my own local machine, but I can't get it to work on my web server. My web host says they support Python, so I must be doing something wrong. Now, Python is associated with CGI. Do python files have to go into my cgi-bin folder? I've never

Run a cgi shell script in background

爱⌒轻易说出口 提交于 2019-12-30 05:14:08
问题 I've a cgi shell script like this #!/bin/sh # show the page echo Content-type: text/html echo echo "<html><b>Hello world!</b></html>" # the task I want to do in background sleep 100 echo $(date) >> log I want to page to show after the last echo , not at the end of the execution of the script. I've tried putting the code in another file and execute it like this ./background.sh & . It works in console but not in the browser. I use lighttpd 回答1: Close stdout with exec >&- before you execute your

How to use Python/CGI for file uploading

限于喜欢 提交于 2019-12-30 04:47:04
问题 I'm trying to make a file uploader page that will prompt the user for a file and will upload while displaying progress. At the moment I've managed to make a simple HTML page that can calls my python script. The python script will then get the file and upload in 1000 byte chunks. I have two main problem (mainly due to be completely new to this): 1) I can't get the file size to calculate percentage 2) I don't know how to communicate between the server side python and whatever is in the page to

How can I read the URL parameter in a Perl CGI program?

自古美人都是妖i 提交于 2019-12-30 03:18:09
问题 How can I read the URL parameter in a Perl CGI program? 回答1: For GET requests , CGI parses the specified parameters and makes them available via the param() method. For POST requests , param() will return the parameters from the postdata, but any parameters specified via a query string in the URL itself are still available from the url_param() method. (This is can be helpful when a POST request is larger than $CGI::POST_MAX ; in that case, CGI just discards the postdata, but you can arrange

Upload a File with Python

给你一囗甜甜゛ 提交于 2019-12-30 03:17:06
问题 I have an HTML form and I am using Python to generate a log file based on the input. I'd like to also be able to allow the user to upload an image if they choose. I can figure out how to manipulate it with Python once it's there, but I'm not sure how to get the image uploaded. This has most certainly been done before, but I'm having a hard time finding any examples. Can any of you point me in the right direction? Basically, I'm using cgi.FieldStorage and csv.writer to make the log. I want to

Webpage redirect to the main page with CGI Python

我的未来我决定 提交于 2019-12-28 04:31:07
问题 As my first web app I developed a very simple survey. Random questions are being asked from the user anytime the page refreshes. The answer is sent to a cgi script using post to save the answers to the database. However, when the user presses the submit button it automatically goes to the page which is responsible for processing the data and since it doesn't have any output it is a blank page. Now if the user wants to answer another question they have to press the "back" in the browser and

Python高级教程---(CGI)study Python 9day yes-3

余生长醉 提交于 2019-12-28 01:40:26
Python CGI编程 什么是 CGI CGI 目前由 NCSA 维护,NCSA 定义 CGI 如下: CGI(Common Gateway Interface),通用网关接口,它是一段程序,运行在服务器上如:HTTP 服务器,提供同客户端 HTML 页面的接口。 网页浏览 为了更好的了解 CGI 是如何工作的,我们可以从在网页上点击一个链接或 URL 的流程: 1、使用你的浏览器访问 URL 并连接到 HTTP web 服务器。 2、Web 服务器接收到请求信息后会解析 URL,并查找访问的文件在服务器上是否存在,如果存在返回文件的内容,否则返回错误信息。 3、浏览器从服务器上接收信息,并显示接收的文件或者错误信息。 CGI 程序可以是 Python 脚本,PERL 脚本,SHELL 脚本,C 或者 C++ 程序等。 CGI架构图 Web 服务器支持及配置 在你进行 CGI 编程前,确保您的 Web 服务器支持 CGI 及已经配置了 CGI 的处理程序。 Apache 支持 CGI 配置: 设置好CGI目录: ScriptAlias /cgi-bin/ /var/www/cgi-bin/ 所有的HTTP服务器执行 CGI 程序都保存在一个预先配置的目录。这个目录被称为 CGI 目录,并按照惯例,它被命名为 /var/www/cgi-bin 目录。 CGI 文件的扩展名为

Are there any problems handling a POST request as a GET request on the server

☆樱花仙子☆ 提交于 2019-12-26 15:29:28
问题 In an attempt to resolve the issue I posted in this question: Is it possible to send POST parameters to a CGI script using a system() call? So far the only successful resolution to the problem is to trick the environment to think the request was a GET. I do this by converting the POST parameters to a query string, saving that string in the default environment variable, then changing the environment variable that tells the server what method this request is using to GET. $ENV{'QUERY_STRING'} =

您试图从目录中执行CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序

六月ゝ 毕业季﹏ 提交于 2019-12-26 09:38:22
本人使用WIN2003 INTERNET信息服务(IIS)管理器建立一个网站虚拟目录,结果浏览网页时出现错误,错误提示信息大体如此:   该页无法显示   您试图从目录中执行 CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序。   请尝试以下操作: * 如果您认为该目录应该允许执行访问权限,请与网站管理员联系。   HTTP 错误 403.1 - 禁止访问:执行访问被拒绝。   Internet 信息服务 (IIS)   技术信息(为技术支持人员提供) * 转到 Microsoft 产品支持服务并搜索包括“HTTP”和“403”的标题。 * 打开“IIS 帮助”(可在 IIS 管理器 (inetmgr) 中访问),然后搜索标题为“配置 ISAPI 扩展”、“配置 CGI 应用程序”、“使用网站权限保护站点”和“关于自定义错误消息”的主题。 * 在 IIS 软件开发工具包 (SDK) 或 MSDN Online Library 中,搜索标题为“Developing ISAPI Extensions”、“ISAPI and CGI”和“Debugging ISAPI Extensions and Filters”的主题。   以下是解决的方法:   单击操作系统的开始→程序→管理工具→Interneter服务器管理,在IIS中选择您的站点然后右键→属性,在虚拟目录选项中