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
5,194
questions
0
votes
0
answers
30
views
How to call php cgi from C++ httpWebserver? [closed]
I write a webserver from 0 in c++. in this moment i write a http request parsing. after parsing request i have all data from request. Request Line, Headers, Request Method, etc. If i receive a path ...
0
votes
1
answer
26
views
lighttpd return 403 for python script that had been working on older installs
I have a github for a kiln controller that runs on raspberry pi. I did not write the server setup. I did change it enough to run python 3 when that started being an issue. Wrote an install script ...
0
votes
2
answers
18
views
I get a 404 error while trying to open my python file using apache cgi
I'm new to python backend development, I was trying to set up an apache to use cgi-bin and a simple python file.
This is my apache2.conf (I"ve added the following):
<Directory "/var/www/...
0
votes
0
answers
13
views
.htaccess redirect dynamic URLs to new system [duplicate]
I've got an old CGI/Perl based news system that generated URLs like this (only the bit after id= changes / is dynamic):
https://www.mysite.co.uk/cgi-bin/news/viewnews.cgi?id=EEyulAFAAESQUwZyzN
I've ...
0
votes
0
answers
29
views
Can't POST with python's http.server (code 501 Can only POST to CGI scripts)
Here is the python code I use to launch a server (when in the directory D:my-app/ where I have my html and javascript files) :
import http.server
server = http.server.HTTPServer
handler = http.server....
0
votes
0
answers
36
views
Failed to download file from the URL. The server committed a protocol violation. Section=ResponseHeader Detail=Content-Length header value is invalid
I'm facing an issue with downloading a file from a specific URL when using a desktop browser, while it works perfectly on a mobile device (Chrome browser). I've thoroughly tested this in multiple ...
0
votes
0
answers
28
views
How to upload a file with Quasar's q-uploader component to a server running python/cgi?
Hello I am running Apache2 web server on Windows 10 and want to upload single file with Quasar's q-uploader component via python/cgi?
I tried a lot but cannot solve the problem alone.
There is an ...
0
votes
0
answers
85
views
How to refresh symlink in PHP-FPM under apache
I have PHP-FPM running under Apache, and I use symlinks to switch between releases, like /html -> /release/1
However it is a well-know problem that symlinked files are cached under PHP-FPM. The ...
0
votes
0
answers
41
views
What Python code for replacing cgi.FieldStorage for reading contents of uploaded files?
Since the python cgi module will soon be removed, I need a way to capture file contents uploaded through an HTML form that looks like this:
<form id="uploadfile" method="post" ...
0
votes
1
answer
101
views
CGI deployment for a Django Webapp e.g. Strato.de Webhosting
iam trying to deploy my django app via cgi on strato.de . Strato only supports basic cgi so iam forced to use this method.
I already made a flask app run on strato via cgi with this tutorial ( btw ...
0
votes
1
answer
30
views
Sending uploaded file from JS to Python CGI always results in ampty dictionary
I have an HTML form that has a file input element. When submitting the form, a JS function is executed which checks if the uploaded file is a PDF file and is less than 10MB. All of this works ...
0
votes
0
answers
24
views
ModuleNotFoundError when activating venv virtual environment in a python CGI script
I just started using the huggingface transformers library and have been experimenting with it via Pytorch and venv.
If I activate the venv virtual environment from a shell, it works just fine.
However,...
0
votes
0
answers
9
views
Why when I use print(type()) in cgi, it returns nothing in my webages?
#!/usr/bin/env python3
print('content-type: text/html\n')
print(type(True))
When I excute this code in teminal, it returned
<class 'bool'>
But when I excute this code in cgi, it returned ...
2
votes
2
answers
110
views
CGI::param called in list context and Undefined subroutine &CGI::Plus::randword called errors
I am trying to dockerize a web application which is in perl and at the end it connects with MariaDB via Apache.
I already have a database setup. My containers are running but the problem is with perl ...
0
votes
0
answers
37
views
Windows CMD window popping up when CGI is run with Python in virtual env
I need to run a CGI script written in Python on Apache on Windows 10. I observe a CMD window pops up for a fraction of a second every time it is executed, but only when the shebang in the script ...
1
vote
0
answers
35
views
CGI perl script can't write to file
I'm running Apache 2.4 on Centos 7. I've spent a week on this problem and it's getting stressful (this is a test file, I'm setting up access for a third party to be able to write to a file on the ...
0
votes
1
answer
69
views
Got [cgi:error] AH01215: (8)Exec format error: exec of '/cgi-bin/echarts.js' failed
Perl script use CGI to generate html with echarts.js. Error information like below:
[Fri Aug 25 10:07:17.488252 2023] [cgi:error] [pid xx] [client xxxx] AH01215: (8)Exec format error: exec of '/cgi-...
0
votes
0
answers
27
views
Python web server does not close stdin in CGI script
A Python simple webserver is started to serve a POST request.
In the CGI script, reading the request body from stdin hangs.
CGI script:
#! /bin/bash
echo "Content-Type: text/plain"
echo
cat
...
0
votes
0
answers
28
views
Python and FastCGI protocol
I try to understand what types of web-servers exist (static Apache Server, Apache Server + CGI, Apache Server + FastCGI).
So, my question: how to setup Apache Server to run python with FastCGI ...
0
votes
0
answers
54
views
Do I need to check for log_username and session username in CGI::Session?
This code checks whether $user which comes from the login form and $session_user which comes from the cgisess_* file stored in the /tmp directory are defined. One of the cases is when $user and $...
0
votes
0
answers
54
views
Why I don't need Content-type when my DirectoryIndex points to a Perl CGI script
I changed the file mods-available/dir.conf this way:
DirectoryIndex /cgi-bin/csv_auth
In csv_auth which is a Perl CGI script I have this:
#! /usr/bin/perl ...
0
votes
0
answers
27
views
Is it safe to execute CGI script using a XMLHttpRequest?
Is it safe to execute a CGI script using a XMLHttpRequest wrapped by <script> just before the page loads?
I want to check if the user is logged in or not before loading anything so I call a CGI ...
1
vote
2
answers
162
views
Invisible files in /tmp directory
I have a CGI::Session script that writes the session id to the /tmp file. The script doesn't error out, but when I check the /tmp directory, I don't find the cgisess* file. This is the permission of /...
1
vote
3
answers
70
views
Why can't I interpolate the $cgi->param($key)?
I am debugging this script and the value of the CGI params are showing up like this:
username
CGI=HASH(0x55887d94d850)->param{username} <--- Why is that? It should show the value.
password
CGI=...
0
votes
0
answers
64
views
Cookie is stored in the browser but the session id is not stored in /tmp (perl CGI::Session)
I wrote this simple script derived from various tutorials and material from this site.
The cookie is stored in the browser but I am not seeing anything about this session written to /tmp.
Where does $...
-3
votes
1
answer
71
views
Why my php and python files are not running in mac [duplicate]
I have installed php and python in my mac and made the changes required in httpd.conf file as well.
I have restarted the apache web server as well.
Here is my php webpage
Here is my python webpage
...
-1
votes
1
answer
31
views
New session created for each instance in Perl web app using CGI::Application::Plugin::Session
Caveat: similar to, but still different from this thread.
In a home-rolled ecomm app, a session with a param of order_id is created by a Perl module common to all instances when an item is added to ...
0
votes
0
answers
46
views
Write data of a binary file to CGI stdout
I am trying to create a small program in Swift that should run as a CGI binary with Apache HTTP Server. The binary should load a file and return it to the CGI stdout.
So entering the URL https://...
0
votes
0
answers
94
views
CGI script return 500 Internal Server Error from web, although work from command line
OS: AlmaLinux 8.8. Server version: Apache/2.4.37 (AlmaLinux). Command:
perl /home/user1/public_html/test.cgi return:
Content-type:text/html
Hello!
File properties:
-rwxr-xr-x. 1 nobody nobody ...
0
votes
1
answer
41
views
chpasswd.cgi - change password on web won't work with more than 8 chars
Good night!
I'm using a chpasswd.cgi to change password via web, the problem is that when I change the password to 123456789 it won't work. I'm migrating a proxy server to a new one, and I have more ...
0
votes
0
answers
19
views
Strange behavior of simple Python CGI script
For testing purposes, I created a very simple CGI script in Python 2.7, as shown below:
#!/usr/bin/env python
import os
import sys
version = sys.version.split('\n')[0]
print "Content-Type: text/...
1
vote
1
answer
85
views
Perl script not displaying properly within Apache web server (Mac)
So I have a Perl script that I want to run within an Apache web server and everything seems to be working correctly except for the formatting. The server displays the Perl script as plain text rather ...
1
vote
1
answer
58
views
sscanf ignoring "&" and scanning past where it is supposed to
I am using a .cpp file I compiled to run as a .cgi file on my website, receiving data from a web form, which it then runs sscanf() on to get the data extracted from the formatting that was sent in.
...
0
votes
0
answers
745
views
Since the CGI module is slated to be deprecated in Python 3.13, what is a good substitution for cgi.FieldStorage?
I tried to use multipart, email.message, html.parse and requests but none seem to be doing what I need, which is getting the fields of an HTML form. Any suggestions?
0
votes
1
answer
60
views
Which permission for a directory when CGI code creates subdir?
In a CGI script, I execute a system call to make a directory, namely mkdir $dir. The parent directory under which this new directory is being created has a permission of 755. It doesn't allow me to ...
1
vote
0
answers
28
views
Display Warning Message if Any Form Fields are Blank - Python/CGI/HTML
I have a small application that displays a form with four fields. I'm trying to build in some validation so that a warning message is displayed if one or all of the fields are blank when a user clicks ...
0
votes
2
answers
38
views
CSS print shows white Bar
I'm trying to create an ticket width the dimensions (203mmx82mm). This is in HTML and CSS via python (cgi, jinja2, weasyprint) the template will be converted to an pdf, which the user can download via ...
1
vote
0
answers
56
views
Wampserver C++ CGI Script 500 Internal Server Error
I am using gcc compiler to compile both C and C++ CGI scripts. My C CGI script works just fine. However, I am getting a 500 Internal Server Error for running C++ CGI scripts. Here is my C++ code:
#...
0
votes
0
answers
28
views
Protecting CGI scripts from outter call
I have written a Python CGI script that accepts JSON input and returns JSON output. The script is hosted on an Apache web server, and it communicates with a PHP/HTML/JavaScript application.
I am ...
1
vote
1
answer
82
views
How to pass perl $dbh objects between scripts
I have to maintain some Perl CGI scripts in our production codebase. The problem is that when the CGI job runs, it takes some time to instantiate the Perl DB's $dbh object before it could be used to ...
1
vote
1
answer
28
views
What legacy OS/Web server could have used CGI EXE files of type "ELF 32-bit MSB executable MIPS SYSV"?
This is a complete shot in the dark, but I have some hope.
I am attempting to resurrect a (large) legacy web application from around 1999-2001 in a VM. The application has a cgi-local folder with a ...
1
vote
1
answer
53
views
Pandas Dataframe as Excel via CGI
I would like to return a Pandas DataFrame in a CGI script as an Excel file based on a query.
However, Excel cannot open the file, reports that the file is corrupted.
The transmitted file seems to be a ...
1
vote
0
answers
37
views
Getting blank screen in Perl CGI when it does some pre-processing and spinner is shown much later
I have added a spinner in Perl CGI script that is shown when the page gets loaded using onload() event. Before the page loads, it has to do some pre-processing to generate the results to be shown on ...
-1
votes
2
answers
41
views
Another CGI/shell question (receiving FORM data in script)
Briefly: After a long time away from web tech, I'm experimenting with it again as I prepare to retire. Thus, this is merely a sandbox experiment I'm trying on my local machine. I'm using the X1 ...
1
vote
2
answers
170
views
My perl CGI script gives "Internal Server Error"
I'm new to writing CGI scripts and I'm having a problem with a script I've written whose purpose is to duplicate the string given in the first argument as much
times the value in the second argument. ...
0
votes
1
answer
362
views
What is the code to handle file uploads in Python3 in a nice way to replace cgi.py when it deprecates in 3.13
I am trying to replace the cgi.py module code because it will be deprecated in Python 3.13. The code handles get and post methods, however, I'd like it to also be able to handle file uploads, what ...
2
votes
1
answer
572
views
Replacing CGI that will be deprecated
I read that multipart and email.message are candidates for using for processing HTML forms. Neither one works for me. Can somebody point me to an example for how to process an HTML form without using ...
0
votes
1
answer
195
views
Possible to cancel curl HTTP PUT from server?
I have a CGI program written in C that reads a PUT request from curl on the client and copies the uploaded file to a directory on the server. This all works fine.
The problem is, I need a way of ...
-1
votes
1
answer
86
views
How to send output of cgi file to html file [closed]
I am hosting a web server on a raspberry pi 4B. It has no desktop lite os. I connected 3 LEDs to the Raspberry pi GPIOs and am controlling them on website from my laptop. I can turn it off and on with ...
2
votes
0
answers
37
views
Python3 CGI: 'NoneType' object has no attribute 'read'
I wonder if this is a bug in Python 3.09/3.10 (I haven't tested this on 3.11, since miniconda still does not support it yet).
The following gives me an AttributeError: 'NoneType' object has no ...