cgi

Cannot run cgi, show plain text only (Ubuntu 13.10 Apache 2.4)

那年仲夏 提交于 2021-02-06 10:06:58
问题 I just install Ubuntu 13.10 and I am trying to install Apache. But when I tried to run a perl file in cgi-bin, the browser showed only plain text. My default.conf of Apache is below: AddHandler cgi-script .cgi .pl ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +Indexes +ExecCGI +MultiViews +SymLinksIfOwnerMatch #Order allow,deny Require all granted Allow from all </Directory> This is my perl cgi file: #!/usr/bin/perl print "Content-type: text

What is considered the current industry standard alternative to CGI for Python web development?

核能气质少年 提交于 2021-02-04 19:18:25
问题 For one of my classes last semester I had to create a website using a CGI script. While it was a good introduction to web development, but I can see it has it's limitations. So my question is, in the industry today, what is the most common approach for parsing a Python script into html? I have found a few posts on Stack Overflow that suggest FastCGI for PHP, but I am wondering if the same answers apply to Python. 回答1: I assume that I would use .py rather than .cgi? If that's the case, how

CGI - HTML to python

那年仲夏 提交于 2021-01-29 19:00:31
问题 I am following the tutorial CGI, when I try to execute the program #!C:/Python27/python.exe # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields first_name = form.getvalue('first_name') last_name = form.getvalue('last_name') print "Content-type:text/html\r\n\r\n" print "<html>" print "<head>" print "<title>Hello - Second CGI Program</title>" print "</head>" print "<body>" print "<h2>Hello %s %s</h2>" % (first

How to listen to an event using sockets?

二次信任 提交于 2021-01-29 06:26:49
问题 We are trying to add play/pause/record buttons to a webpage that shows a video stream. The video is streaming from the server and the webpage is on the client-side. Now the client can see the video stream on the webpage, but we wanted to add some buttons. This is the code that sends the video using sockets: void stream(cv::Mat* frame){ TCPServer serverInputConnection("localhost", 8080); serverInputConnection.createListener(); ////////////////////// reconnect network cycle ////////////////////

best way to loop through and combine products

谁都会走 提交于 2021-01-29 06:18:31
问题 I'm looking for your personal thoughts on the best way to do this as there a number of ways that I can see to get to the same end. I have a store front that has multiple different booklets that can be ordered in any combination. Each booklet item has L x W x H and weight in the database. They're all really the same L x W, it's the thickness and weight that varies. I also have a set max box size. I know I can fit a height of 10.5 in the largest box size. I can combine the books however for

How to run this simple Perl CGI script on Mac from terminal?

安稳与你 提交于 2021-01-28 13:36:02
问题 This simple .pl script is supposed to grab all of the images in a directory and output an HTML — that when opened in a browser — displays all of the images in that dir at their natural dimensions. From the mac command line, I want to just say perl myscript.pl and have it run. … It used to run on apache in /cgi-bin . #!/usr/bin/perl -wT # myscript.pl use strict; use CGI; use Image::Size; my $q = new CGI; my $imageDir = "./"; my @images; opendir DIR, "$imageDir" or die "Can't open $imageDir $!"

CGI error Can't use an array as a reference

假装没事ソ 提交于 2021-01-28 06:50:26
问题 My configuration is Debian Stretch I verify my Perl code with the command line perl -wcT admin.cgi I have an error in the code at this line: print &select("$id-2",\@values,\@values,@{$FORMAT{$name}}->[1]),"<br /> \n"; The error is: Can't use an array as a reference I also tried with this web editor It seems that the error is : @{$FORMAT{$name}}->[1] 回答1: As you say, the problem is here: @{$FORMAT{$name}}->[1] It appears that $FORMAT{$name} is expected to contain an array reference. And you

ImportError: No module named 'matplotlib._path' when running a python script in apache2

爱⌒轻易说出口 提交于 2021-01-28 05:45:39
问题 I have been busting my head over this for a few hours now but I cant nail down the reason why this error occurs. I am trying to run a simple python script in my apache2 server- #!/usr/bin/python3.5 import cgi import cgitb cgitb.enable() import sys sys.path.insert(0, "/home/aswin/anaconda3/lib/python3.6/site-packages") sys.path.insert(0,"/usr/local/lib/python3.5/dist-packages") # HEADERS print("Content-Type:text/html; charset=UTF-8") print() # blank line required at end of headers # CONTENT

AH01215: (8) Exec format error: exec of '/var/www/python/hello.py' failed: /var/www/python/hello.py

冷暖自知 提交于 2021-01-27 07:55:54
问题 I am trying to run python as CGI in apache server. Python version is 2.7.12. Here is my apache conf file <VirtualHost *:80> <Directory /var/www/python> Options +ExecCGI AddHandler cgi-script .cgi .py Order allow,deny Allow from all </Directory> DocumentRoot /var/www/python ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> My python script /var/www/python/hello.py looks like this print('Content-Type: text/html; charset=utf-8\n') print("Hello,

AH01215: (8) Exec format error: exec of '/var/www/python/hello.py' failed: /var/www/python/hello.py

人走茶凉 提交于 2021-01-27 07:53:18
问题 I am trying to run python as CGI in apache server. Python version is 2.7.12. Here is my apache conf file <VirtualHost *:80> <Directory /var/www/python> Options +ExecCGI AddHandler cgi-script .cgi .py Order allow,deny Allow from all </Directory> DocumentRoot /var/www/python ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> My python script /var/www/python/hello.py looks like this print('Content-Type: text/html; charset=utf-8\n') print("Hello,