Questions tagged [cgi]

1) The Common Gateway Interface is a standard defining how web server software can delegate web page generation to a stand-alone application or executable file. 2) Computer Generated Imagery

This tag is mostly used for the Common Gateway Interface (CGI), which is a standard (see RFC 3875: CGI Version 1.1) that defines how web server software can delegate the generation of web pages to a stand-alone application, an executable file. Such applications are known as CGI scripts; they can be written in any programming language, although scripting languages are often used.

Less commonly on Stack Overflow, CGI may also be used to tag questions regarding Computer Generated Imagery.

See also

5191 questions
33
votes
7 answers

How to run CGI scripts on Nginx

I have problem setting up CGI scripts to be run on Nginx, so far I've found http://wiki.nginx.org/SimpleCGI this stuff but problem is that I can't make perl script run as service so that it will run in background and even in case of restart it will…
Askhat
  • 347
  • 1
  • 3
  • 7
29
votes
3 answers

How to run CGI "hello world" with python http.server

I am using Windows 7 and Python 3.4.3. I would like to run this simple helloworld.py file in my browser: print('Content-Type: text/html') print( '') print( '') print( '') print( '

Hello World

') print(…
Yura
  • 2,381
  • 8
  • 33
  • 44
28
votes
1 answer

Multipart upload form: Is order guaranteed?

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…
Brian McFarland
  • 9,052
  • 6
  • 38
  • 56
28
votes
5 answers

what is cgi programming

What is exactly meant by CGI programming . If I am writing a cgi program in 'C' , in that context , what does the 'cgi' mean ? Is the servelt environment is an abstraction of classical cgi programming ?
Mariselvam
  • 1,093
  • 2
  • 15
  • 28
28
votes
6 answers

Deploying Go web applications with Apache

I can not find a mod_go for deploying Go web applications. Is there any other way to run web applications in Go with an Apache web server (or even IIS)? Update: Now after doing Go full time for nearly a year; doing this (Go with Apache) is…
Kaveh Shahbazian
  • 13,088
  • 13
  • 80
  • 139
27
votes
1 answer

should I reuse the cursor in the python MySQLdb module

I'm writing a python CGI script that will query a MySQL database. I'm using the MySQLdb module. Since the database will be queryed repeatedly, I wrote this function.... def getDatabaseResult(sqlQuery,connectioninfohere): # connect to the…
b10hazard
  • 7,399
  • 11
  • 40
  • 53
27
votes
16 answers

How to parse $QUERY_STRING from a bash CGI script?

I have a bash script that is being used in a CGI. The CGI sets the $QUERY_STRING environment variable by reading everything after the ? in the URL. For example, http://example.com?a=123&b=456&c=ok sets QUERY_STRING=a=123&b=456&c=ok. Somewhere I…
User1
  • 39,458
  • 69
  • 187
  • 265
26
votes
9 answers

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

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…
Dustin Wyatt
  • 4,046
  • 5
  • 31
  • 60
26
votes
2 answers

Getting HTTP GET arguments in Python

I'm trying to run an Icecast stream using a simple Python script to pick a random song from the list of songs on the server. I'm looking to add a voting/request interface, and my host allows use of python to serve webpages through CGI. However, I'm…
James
  • 1,239
  • 1
  • 11
  • 18
26
votes
2 answers

Why does PHP_SAPI not equal 'cli' when called from a cron job?

Here is the line from my cron job... */5 * * * * php /home/user/public_html/index.php --uri=minion --task=emailassets When my script runs from this cron job, the PHP constant PHP_SAPI equals 'cgi-fcgi'. Why does PHP_SAPI not equal 'cli'?
Chad
  • 1,708
  • 1
  • 25
  • 44
25
votes
9 answers

Pros and Cons of different approaches to web programming in Python

I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that. It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the…
Tomas Sedovic
  • 42,675
  • 9
  • 40
  • 30
25
votes
6 answers

Dynamically serving a matplotlib image to the web using python

This question has been asked in a similar way here but the answer was way over my head (I'm super new to python and web development) so I'm hoping there's a simpler way or it could be explained differently. I'm trying to generate an image using…
Ben S.
  • 3,415
  • 7
  • 22
  • 43
24
votes
12 answers

Error 500: Premature end of script headers

I get a "Premature end of script headers: contactform.cgi" error message when running the below script. What frustrates me is that I ran this as a .php on another server and it worked. However, I had to change servers and they only support CGI…
neuquen
  • 3,991
  • 15
  • 58
  • 78
24
votes
11 answers

What are CGI scripts used for these days?

I'm pretty well up to speed on general web programming languages, but one of the tools I'm working with right now is in CGI. All I can tell is that CGI scripts are quite slow. Is CGI still commonly used today? If not, what has it been replaced…
Dirk
  • 6,774
  • 14
  • 51
  • 73
23
votes
7 answers

Set encoding in Python 3 CGI scripts

When writing a Python 3.1 CGI script, I run into horrible UnicodeDecodeErrors. However, when running the script on the command line, everything works. It seems that open() and print() use the return value of locale.getpreferredencoding() to know…
jforberg
  • 6,537
  • 3
  • 29
  • 47