cgi

Return Image from python CGI using javascript

这一生的挚爱 提交于 2019-12-23 02:52:29
问题 I am using Python CGI to create a webpage that shows a title, dropdown menu and image. I would like to be able to select an option from the dropdown menu (would love to get rid of "submit" as well and just run when an option is chosen), trigger my python code (runthis.py) and update the image on the webpage. I want to do this WITHOUT opening new tabs and hopefully without refreshing the page. Currently I run this .py file to get my html: #!C:\Python27\python print "Content-type: text/html"

How do CGIs and Servlets execute differently?

北城以北 提交于 2019-12-23 01:55:36
问题 My understanding is that a CGI spawns a separate executable process on the server each time but that a Servlet does not do that - but I'm not sure how to describe what happens with a servlet by comparison. Since the servlet exists inside the JVM and the JVM is a single process, where does the Servlet exist in relation to it? 回答1: At runtime, a CGI process is launched by the web server as a separate OS shell. The shell includes an OS environment and process to execute the CGI code, which

MySQL connection not working from within Perl CGI script

好久不见. 提交于 2019-12-22 20:47:31
问题 I can easily connect to a remote MySQL server using the DBI module in my Perl scripts. However, when I try to use the same connection settings/properties from within a CGI script, the connection fails. There are no helpful errors/warnings being logged either in the apache error log, or the browser, in spite of using use CGI::Carp qw(warningsToBrowser fatalsToBrowser); Strangely, the exact same script works fine when executed from the terminal. I also tried connecting the CGI script to the

Do CGI and mod_perl play nicely together?

喜你入骨 提交于 2019-12-22 13:59:57
问题 I've got an apache web server (without mod_perl) that's been running just fine for a long time. It has been suggested that we use mod_perl to improve the performance of some scripts. I want to go ahead and install mod_perl on the server, which seems to be a relatively straightforward process, but I'm confused by some of the stuff coming up on Google searches. If I install mod_perl (through the debian repositories), will all of my existing CGIs suddenly start "using mod_perl" and exhibiting

PHP-FPM详解

女生的网名这么多〃 提交于 2019-12-22 12:28:49
PHP-FPM详解 目录 作用 安装 全局配置 配置进程池 参考Company开发环境 转发请求给PHP-FPM 思考 作用 PHP-FPM(PHP FastCGI Process Manager)意:PHP FastCGI 进程管理器,用于管理PHP 进程池的软件,用于接受web服务器的请求。 PHP-FPM提供了更好的PHP进程管理方式,可以有效控制内存和进程、可以平滑重载PHP配置。 (1). 为什么会出现php-fpm fpm的出现全部因为php-fastcgi出现。为了很好的管理php-fastcgi而实现的一个程序 (2). 什么是php-fastcgi php-fastcgi 只是一个cgi程序,只会解析php请求,并且返回结果,不会管理(因此才出现的php-fpm)。 (3)为什么不叫php-cgi 其实在php-fastcgi出现之前是有一个php-cgi存在的,只是它的执行效率低下,因此被php-fastcgi取代。 (4)那fastcgi和cgi有什么区别呢? 亲们,这区别就大了,当一个服务web-server(nginx)分发过来请求的时候,通过匹配后缀知道该请求是个动态的php请求,会把这个请求转给php。 在cgi的年代,思想比较保守,总是一个请求过来后,去读取php.ini里的基础配置信息,初始化执行环境,每次都要不停的去创建一个进程,读取配置

How can I implement server-side rate limiting for a Perl web service?

笑着哭i 提交于 2019-12-22 09:15:09
问题 I have a Perl-based CGI/Fast CGI web service and want to rate-limit clients by IP address to stop aggressive clients causing too much work. I have looked around for some code and found Algorithm::TokenBucket in CPAN but that is for client requests; it has no persistence and has no per-user config so is not really useful for server-side rate limiting. I am looking for suggestions for something that already exists, otherwise I'll need to roll my own based on some simple persistence such as tie

How to deploy a gSOAP Web Service in Ubuntu?

你。 提交于 2019-12-22 09:10:23
问题 I have a doubt concerning the deployment of a Web Service in Ubuntu. It was implemented using gSOAP and it should be deployed, e.g. be accessible from websites (which are developed in e.g. ASP .NET). I got confused with the whole CGI, Ubuntu, Apache topics. Until now I was able to implement a Web Service in ASP .NET and deploy it on Microsoft ISS. Other than that I can also access a gSOAP Web Service described in a WSDL, using ASP .NET What are the steps to deploy my own Web Service? I have

Redirecting CGI error output from STDERR to a file (python AND perl)

℡╲_俬逩灬. 提交于 2019-12-22 09:10:01
问题 I'm moving a website to Hostmonster and asked where the server log is located so I can automatically scan it for CGI errors. I was told, "We're sorry, but we do not have cgi errors go to any files that you have access to." For organizational reasons I'm stuck with Hostmonster and this awful policy, so as a workaround I thought maybe I'd modify the CGI scripts to redirect STDERR to a custom log file. I have a lot of scripts (269) so I need an easy way in both Python and Perl to redirect STDERR

How to display a “waiting page” while a CGI is running?

大憨熊 提交于 2019-12-22 08:52:22
问题 I have a cgi script that takes long time (30 sec) to generate the results before printing out the html. I want to show an intermediary page that says "Loading, please wait..." with an animated GIF before displaying the results. Thanks 回答1: Fork the process and keep a reference to it in a session. Then poll the script periodically for a status update. There is a more detailed explanation with code examples that was originally published in Linux Magazine. Perl Monks has further discussion. You

How to send data to Perl script via ajax?

与世无争的帅哥 提交于 2019-12-22 08:51:34
问题 I want to send data to Perl script via ajax, and to receive a json format back from it. But it doesn't work. I know something is wrong in the following scripts. Does anyone know how to fix it? jQuery code: $("#test").click(function(){ var ID = 100; var data = { data_id : ID }; $.ajax({ type: "POST", url: "ajax.cgi", data: data, success: function(msg){ window.alert(msg); } }); }); ajax.cgi (perl script): #!/usr/bin/perl use CGI; use DBI; $cgi = CGI->new; # Here I'd like to receive data from