cgi

Configuring IIS 6.0 to execute cgi(.exe)

五迷三道 提交于 2019-12-03 08:08:35
I already create a virtual directory (cgi-bin) with permission : Scripts and Executable... When I test : http://localhost/cgi-bin/mapserv.exe , I got 404 error, The page cannot be found Am I supposed to Add a EXTENSION mapping to .exe files ? Which executable ? Thanks! I solved that: Go to Web Service Extensions in the IIS service manager Select Add a new web service extension. On the required files tab, add C:\YourMapserverInstalldir\mapserv.exe Set it to allow Thanks anyway... Yes, you will have to create an application mapping between the file name extension of your script and the script

Apache/httpd /var/www/html/ .cgi scripts throw 500 internal server error

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed a new CentOS 7 x86_64 LAMP server today. I compiled a simple CGI script in c and i called it test.cgi, and I enabled the AddHandler for .cgi scripts. However everytime i try to load the /test.cgi page from my /var/www/html directory any simple .cgi script will throw me a 500 internal server error page. I tested that the script is working fine from the /var/www/cgi-bin directory. My server is running selinux and apache/httpd is using suEXEC. EDIT: also I didn't create any extra users after the lamp installation so here I'm using

Python 3, is using sys.stdout.buffer.write() good style?

六眼飞鱼酱① 提交于 2019-12-03 07:44:10
After I learned about reading unicode files in Python 3.0 web script, now it's time for me to learn using print() with unicode. I searched for writing unicode, for example this question explains that you can't write unicode characters to non-unicode console. However, in my case, the output is given to Apache and I am sure that it is capable of handling unicode text. For some reason, however, the stdout of my web script is in ascii . Obviously, if I was opening a file to write myself, I would do something like open(filename, 'w', encoding='utf8') but since I'm given an open stream, I resorted

How to parse the “request body” using python CGI?

坚强是说给别人听的谎言 提交于 2019-12-03 07:22:30
I just need to write a simple python CGI script to parse the contents of a POST request containing JSON. This is only test code so that I can test a client application until the actual server is ready (written by someone else). I can read the cgi.FieldStorage() and dump the keys() but the request body containing the JSON is nowhere to be found. I can also dump the os.environ() which provides lots of info except that I do not see a variable containing the request body. Any input appreciated. Chris If you're using CGI, just read data from stdin : import sys data = sys.stdin.read() Zhihao Wang

Perl's JSON::XS not encoding UTF8 correctly?

我们两清 提交于 2019-12-03 07:09:41
This simple code segment shows an issue I am having with JSON::XS encoding in Perl: #!/usr/bin/perl use strict; use warnings; use JSON::XS; use utf8; binmode STDOUT, ":encoding(utf8)"; my (%data); $data{code} = "Gewürztraminer"; print "data{code} = " . $data{code} . "\n"; my $json_text = encode_json \%data; print $json_text . "\n"; The output this yields is: johnnyb@boogie:~/Projects/repos > ./jsontest.pl data{code} = Gewürztraminer {"code":"Gewürztraminer"} Now if I comment out the binmode line above I get: johnnyb@boogie:~/Projects/repos > ./jsontest.pl data{code} = Gew�rztraminer {"code":

PHP工作模式详解

ⅰ亾dé卋堺 提交于 2019-12-03 07:01:04
PHP运行模式有4钟: 先了解一下php的SAPI: php的4层结构图: php的工作模式就是与图中的SAPI有关: 关于sapi: Sapi全称是Server Application Programming Interface,也就是服务端应用编程接口,Sapi通过一系列钩子函数,使得PHP可以和外围交互数据,这是PHP非常优雅和成功的一个设计,通过sapi成功的将PHP本身和上层应用解耦隔离,PHP可以不再考虑如何针对不同应用进行兼容,而应用本身也可以针对自己的特点实现不同的处理方式。 1)cgi 通用网关接口(Common Gateway Interface)) 2) fast-cgi 常驻 (long-live) 型的 CGI 3) cli 命令行运行 (Command Line Interface) 4)web模块模式 (apache等web服务器运行的模块模式) 1.CGI(Common Gateway Interface)【 比较老的模式,几乎不怎么用了 】 CGI即通用网关接口(Common Gateway Interface),它是一段程序, 通俗的讲CGI就象是一座桥,把网页和WEB服务器中的执行程序连接起来,它把HTML接收的指令传递给服务器的执行程序,再把服务器执行程序的结果返还给HTML页。CGI 的跨平台性能极佳,几乎可以在任何操作系统上实现。

Run Python CGI Application on Heroku

♀尐吖头ヾ 提交于 2019-12-03 05:57:13
I made a simple application that makes use of Python CGI scripts. I have a working local version (works fine with lighttpd), but now I'd like to upload it to Heroku. The application consists of 2 or 3 scripts that make operations on a file and print information back to the browser, so I don't think I'll need any module other than CGI. But the Heroku documentation only explains how to upload Python applications with fancy web frameworks, and I'm not using any of those. I want to know if it's possible to run CGI scripts on Heroku, and if so, how to do it. Heroku Cedar is centered around self

Trouble running python script as cgi under apache (ubuntu 12)

非 Y 不嫁゛ 提交于 2019-12-03 05:41:31
Disclosure: I searched a lot, and I don't think my question (for my configuration) is answered here. For example run python script as cgi apache server doesn't answer it. So: I have a simplest script possible: #!/usr/bin/env python print "Content-type: text/html" print "" print "<h1>Hello from Python!</h1>" When I run it in a browser, it literally displays itself instead of expected Hello from Python! I did the following to make it run: a) it is executable by everyone; It runs in a shell perfectly. b) it is in a virtual directory that has the following configuration (in/etc/apache2/sites

How to hide “cgi-bin”, “.py”, etc from my URLs?

╄→гoц情女王★ 提交于 2019-12-03 05:11:46
问题 Brand new to web design, using python. Got Apache up and running, test python script working in cgi-bin directory. Get valid results when I type in the URL explicitly: ".../cgi-bin/showenv.py" But I don't want the URL to look that way. Here at stackoverflow, for example, the URLs that display in my address bar never have the messy details showing the script that was used to run them. They're clean of cgi-bin, .py, etc. extensions. How do I do that? EDIT: Thanks for responses, every single one

Output images to html using python

送分小仙女□ 提交于 2019-12-03 05:11:34
问题 I have a webpage generated from python that works as it should, using: print 'Content-type: text/html\n\n' print "" # blank line, end of headers print '<link href="default.css" rel="stylesheet" type="text/css" />' print "<html><head>" I want to add images to this webpage, but when I do this: sys.stdout.write( "Content-type: image/png\n\n" + file("11.png","rb").read() ) print 'Content-type: text/html\n\n' print "" # blank line, end of headers print '<link href="default.css" rel="stylesheet"