cgi

How do I create a webpage with buttons that invoke various Python scripts on the system serving the webpage?

房东的猫 提交于 2019-12-03 18:57:21
问题 I'm a hobbyist (and fairly new) programmer who has written several useful (to me) scripts in python to handle various system automation tasks that involve copying, renaming, and downloading files amongst other sundry activities. I'd like to create a web page served from one of my systems that would merely present a few buttons which would allow me to initiate these scripts remotely. The problem is that I don't know where to start investigating how to do this. Let's say I have a script called:

nginx、apache和lighttpd比较

大城市里の小女人 提交于 2019-12-03 17:36:40
Apache介绍: Apache是基于模块化设计的,它的核心代码并不多,大多数的功能都被分散到各个模块中,各个模块在系统启动的时候按需载入。 MPM(Multi -Processing Modules,多重处理模块)是Apache的核心组件之一, Apache通过MPM来使用操作系统的资源,对进程和线程池进行管理 。Apache为了能够获得最好的运行性能,针对不同的平台 (Unix/Linux、Window)做了优化,为不同的平台提供了不同的MPM,用户可以根据实际情况进行选择, 其中最常使用的MPM有 prefork和worker两种 (两种模式介绍http://my.oschina.net/shyl/blog/523070)。至于您的服务器正以哪种方式运行,取决于安装Apache过程中指定的MPM编译参数,在X系统上默认的编译参数为 prefork。 Apache的CGI和Module: 区别在于一个进程池是web server的进程池,一个是php的进程池;FASTCGI这种模式下,可以比较好的分离动态和静态请求,php出了问题不会影响web server。 Nginx介绍: Nginx的模块从结构上分为核心模块、基础模块和第三方模块: 核心模块:HTTP模块、EVENT模块和MAIL模块 基础模块:HTTP Access模块、HTTP FastCGI模块、HTTP

Output binary data from CGI in Python 3

ⅰ亾dé卋堺 提交于 2019-12-03 16:16:32
This question is related to this one . I was having no problems while printing raw binary data from a CGI script in Python 2, for example: #!/usr/bin/env python2 import os if __name__ == '__main__': with open(os.path.abspath('test.png'), 'rb') as f: print "Content-Type: image/png\n" print f.read() Here are the relevant response headers: > GET /cgi-bin/plot_string2.py HTTP/1.1 > User-Agent: curl/7.32.0 > Host: 0.0.0.0:8888 > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 200 Script output follows < Server: SimpleHTTP/0.6 Python/3.3.2 < Date: Fri, 13 Sep 2013 16:21:25 GMT < Content

Perl CGI to download a file via web browser

感情迁移 提交于 2019-12-03 16:01:28
Need some cgi-perl script which can download a file from a server machine. EX: click on a download link and it will open a "save as" window and will allow me to save the file on my local machine. I have created a web page using CGI, using this I will upload a file to server and will run a perl script to convert it to some other format (till here I am done). Now I need get this file back (download back) to the system. #!/usr/bin/perl #print "Content-type: text/html\n\n"; my $filepath='/upload/testing.pm'; print "Content-Type: text/html\n\n"; open("DOWNLOADFILE", "<".$filePath); while(

What were the main disadvantages of CGI-BIN based web development?

…衆ロ難τιáo~ 提交于 2019-12-03 15:42:13
I was fortunate enough to not do any cgi-bin .cgi based web development. But generally those who have do not seem to 'miss' those days. A project I recently joined has a performance issue when dealing with the pages that need to communicate to a legacy system that has a CGI-BIN based API. That system is COGNOS 7. The feedback I received to date is that 'COGNOS is slow' but others have reported great success with COGNOS, I am thinking it has more to do with the access via CGI-BIN and not the performance of COGNOS in and of itself. All that said what are the main issues that made CGI-BIN based

Internet Explorer 8 + Deflate

我们两清 提交于 2019-12-03 15:14:49
I have a very weird problem.. I really do hope someone has an answer because I wouldn't know where else to ask. I am writing a cgi application in C++ which is executed by Apache and outputs HTML code. I am compressing the HTML output myself - from within my C++ application - since my web host doesn't support mod_deflate for some reason. I tested this with Firefox 2, Firefox 3, Opera 9, Opera 10, Google Chrome, Safari, IE6, IE7, IE8, even wget.. It works with ANYTHING except IE8. IE8 just says "Internet Explorer cannot display the webpage", with no information whatsoever. I know it's because of

POST data to Python CGI script via jQuery AJAX

↘锁芯ラ 提交于 2019-12-03 15:03:42
问题 I'm trying to setup a simple script where some data is sent using the jQuery .ajax function to a Python CGI script. The Python script would just make the data posted to it uppercase, and then return that data to the HTML file, where a div would be updated with the content. I have the code shown below. When I run it, the AJAX call executes, but the div is not updated with the content. the div is not updated with the data being sent. How would I modify this code so that it updates with the data

How do I set up a Python CGI server?

心已入冬 提交于 2019-12-03 13:49:15
问题 I'm running Python 3.2 on Windows. I want to run a simple CGI server on my machine for testing purposes. Here's what I've done so far: I created a python program with the following code: import http.server import socketserver PORT = 8000 Handler = http.server.CGIHTTPRequestHandler httpd = socketserver.TCPServer(("", PORT), Handler) httpd.serve_forever() In the same folder, I created "index.html", a simple HTML file. I then ran the program and went to http://localhost:8000/ in my web browser,

installing composer on a shared host

白昼怎懂夜的黑 提交于 2019-12-03 13:48:50
I am trying to install composer on my shared host for the first time. When I run curl -sS https://getcomposer.org/installer | php I am getting a Composer successfully installed User it: php composer.phar when I run php composer.phar i am getting this warring error: Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI any ideas on how to fix this ? and why i am getting this error ? :( when I run php -v i get this back PHP 5.4.39 (cgi-fcgi) (built: Mar 25 2015 14:20:20) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend

How can I improve Moose performance in non-persistent CGI processes?

谁都会走 提交于 2019-12-03 13:31:16
问题 Moose is a fantastic object framework. The trouble is that, taken together with its dependencies, it's very big. Our profiling indicates that on our platform, simply loading Moose will incur a 5-6 second overhead on non-persistent CGI application scripts. That's just not acceptable for these one-off applications. By contrast, when we're using a persistent process system (such as FCGI), this startup overhead is eliminated (or rather, only incurred once), and all is well. The problem we have is