cgi

Executing a Python script in Apache2

走远了吗. 提交于 2019-11-28 05:06:44
I am trying to execute a Python program using Apache. However, Apache will only serve the file and not actually execute it. The permissions on the file are r/w/x and it is in /var/www . I will post the contents of httpd.conf and the program code after. I also tried to running the python script as a .cgi file but that did not work as well. I have both the mod_python and mod_wsgi modules loaded into apache as well. Python sample: #!/usr/bin/python # enable debugging import cgitb cgitb.enable() print "Content-Type: text/plain\r\n\r\n" print print "Hello World!" httpd.conf: AddHandler cgi-script

Is it faster to access data from files or a database server?

…衆ロ難τιáo~ 提交于 2019-11-28 04:28:42
If I have a static database consisting of folders and files, would access and manipulation be faster than SQL server type databases, considering this would be used in a CGI script? When working with files and folders, what are the tricks to better performance? HerbN I'll add to the it depends crowd. This is the kind of question that has no generic answer but is heavily dependent on the situation at hand. I even recently moved some data from a SQL database to a flat file system because the overhead of the DB, combined with some DB connection reliability issues, made using flat files a better

How to get POST parameters from CGI scripts written in bash?

China☆狼群 提交于 2019-11-28 04:28:22
问题 I'm writing a web application using CGI scripts written in bash. For GET requests, the request parameters are available in a variable named $QUERY_STRING . However, I'm unable to figure out where the similar value would be stored for POST requests. I'm using the following script: #!"c:/msys64/usr/bin/bash.exe" # On *nix, replace above with #!/bin/bash echo -en "Status: 200 OK\r\n" echo -en "Content-type: text/plain\r\n\r\n" declare -x declare -a And this is what I get: $ curl -so - --data

run python script as cgi apache server

大兔子大兔子 提交于 2019-11-28 03:25:13
问题 I am trying to make a python script run as cgi, using an Apache server. My script looks something like this: #!/usr/bin/python import cgi if __name__ == "__main__": print("Content-type: text/html") print("<HTML>") print("<HEAD>") I have done the necessary configurations in httpd.conf(in my opinion): <Directory "/opt/lampp/htdocs/xampp/python"> Options +ExecCGI AddHandler cgi-script .cgi .py Order allow,deny Allow from all </Directory> I have set the execution permission for the script with

What are WSGI and CGI in plain English?

这一生的挚爱 提交于 2019-11-28 02:38:56
Every time I read either WSGI or CGI I cringe. I've tried reading on it before but nothing really has stuck. What is it really in plain English? Does it just pipe requests to a terminal and redirect the output? WSGI runs the Python interpreter on web server start, either as part of the web server process (embedded mode) or as a separate process (daemon mode), and loads the script into it. Each request results in a specific function in the script being called, with the request environment passed as arguments to the function. CGI runs the script as a separate process each request and uses

How can I determine if a script was called from the command line or as a cgi script?

落花浮王杯 提交于 2019-11-28 00:02:19
I have a script that I wrote that can either be used on the command line or as a CGI script, and need to determine how the script was called so I can output a content-type header for web requests (and maybe some anti-cache headers too). My first thought is to check for the existance of http environment variables: my $js = build_javascript(); if ( exists $ENV{HTTP_HOST} ) { print "Content-type: text/javascript\n\n"; } print $js; Is there a better way? VoidPointer According to the CGI specification in RFC3875 (section 4.1.4.), the GATEWAY_INTERFACE environment variable would be the authoritative

云比特软件系统开发

这一生的挚爱 提交于 2019-11-27 23:59:28
无论多大的系统或者多小的网站,云比特系统开发找(肖露:180-2851-9166),一般在它背后都有数据库。那么这个数据库由谁来维护?在一般情况下,谁负责运营这个网络或者系统,那么就由谁来进行维护。如果是微信数据库肯定是腾讯团队维护,淘宝的数据库就是阿里的团队在维护。大家一定认为这种方式是天经地义的,但是区块链技术却不是这样。 如果我们把数据库想象成是一个账本:比如支付宝就是很典型的账本,任何数据的改变就是记账型的。数据库的维护我们可以认为是很简单的记账方式。在区块链的世界也是这样,区块链系统中的每一个人都有机会参与记账。系统会在一段时间内,可能选择十秒钟内,也可能十分钟,选出这段时间记账最快最好的人,由这个人来记账,他会把这段时间数据库的变化和账本的变化记在一个区块(block)中,我们可以把这个区块想象成一页纸上,系统在确认记录正确后,会把过去账本的数据指纹链接(chain)这张纸上,然后把这张纸发给整个系统里面其他的所有人。然后周而复始,系统会寻找下一个记账又快又好的人,而系统中的其他所有人都会获得整个账本的副本。这也就意味着这个系统每一个人都有一模一样的账本,这种技术,我们就称之为区块链技术(Blockchain),也称为分布式账本技术。 云比特CBT区块链开发、云比特(CBT)矿机系统开发、云比特(CBT)软件开发、云比特(CBT)模式制度开发、云比特(CBT

Returning http status codes in Python CGI

…衆ロ難τιáo~ 提交于 2019-11-27 23:39:47
问题 Is it possible to send a status code other than 200 via a python cgi script (such as 301 redirect) 回答1: via cgi script? print "Status:301\nLocation: http://www.google.com" 回答2: Via wsgi application? def simple_app(environ, start_response): status = '301 Moved Permanently' # HTTP Status headers = [('Location','http://example.com')] # HTTP Headers start_response(status, headers) return [] 来源: https://stackoverflow.com/questions/833715/returning-http-status-codes-in-python-cgi

Multipart upload form: Is order guaranteed?

无人久伴 提交于 2019-11-27 22:46:12
It appears that when I use an html form to make a "Content-Type: multipart/form-data" POST request, the fields always appear in the order in which they are listed in the HTML. In practice, do all browsers do this? The primary motivation for wanting to know this is so I can do server-side validation of form data w/o being required to cache the entire HTTP request in RAM | disk first. I know CGI, PHP, etc typically won't do anything 'til the upload completes. Probably because RFC 2388 section 5.5 addresses this issue by saying the order is not defined. I'm working w/ a highly customized fork of

How do I access the HTTP Header of request in a CGI script?

我的梦境 提交于 2019-11-27 22:03:57
问题 I've used Perl a bit for small applications and test code, but I'm new to networking and CGI. I get how to make the header of a request (using CGI.pm and printing the results of the header() function), but haven't been able to find any info on how to access the headers being sent to my CGI script. Could someone point me in the right direction? This could be from a request like this: curl http://127.0.0.1:80/cgi-bin/headers.cgi -H "HeaderAttribute: value" 回答1: The CGI module has a http()