cgi

How can I add internationalization to my Perl script?

耗尽温柔 提交于 2019-12-17 22:55:05
问题 I'm looking at introducing multi-lingual support to a mature CGI application written in Perl. I had originally considered rolling my own solution using a Perl hash (stored on disk) for translation files but then I came across a CPAN module which appears to do just what I want (i18n). Does anyone have any experience with internationalization (specifically the i18n CPAN module) in Perl? Is the i18n module the preferred method for multi-lingual support or should I reconsider a custom solution?

IIS 7.5 PHP failure “The FastCGI process exited unexpectedly”

两盒软妹~` 提交于 2019-12-17 22:47:11
问题 I've been attempting to get PHP working with IIS 7.5 and have hit a bit of a roadblock. Whenever I try to load the page I get the following error: "HTTP Error 500.0 - Internal Server Error C:\Program Files\PHP\php.exe - The FastCGI process exited unexpectedly" Module FastCgiModule Notification ExecuteRequestHandler Handler PHP_via_FastCGI Error Code 0x00000000 Requested URL *http://localhost:80/index.php Physical Path C:\inetpub\wwwroot\index.php Logon Method Anonymous Logon User Anonymous

Special Characters in Content-Disposition filename

本小妞迷上赌 提交于 2019-12-17 21:58:37
问题 This thread is a duplicate of How to encode the filename parameter of Content-Disposition header in HTTP? But since this question was asked a long time ago and there is still no satisfying answer (in my opinion), I would like to ask again. I develop a C++ CGI application that delivers files that can contain special characters in their names like " weird # € = { } ; filename.txt " There seems to be no possibility to set the HTTP Content-Dispostion in a way that it works for every browser like

Python CGI returning an http status code, such as 403?

本秂侑毒 提交于 2019-12-17 20:35:00
问题 How can my python cgi return a specific http status code, such as 403 or 418? I tried the obvious (print "Status:403 Forbidden") but it doesn't work. 回答1: print 'Status: 403 Forbidden' print Works for me. You do need the second print though, as you need a double-newline to end the HTTP response headers. Otherwise your web server may complain you aren't sending it a complete set of headers. sys.stdout('Status: 403 Forbidden\r\n\r\n') may be technically more correct, according to RFC (assuming

How to give multiple values to a single key using a dictionary?

纵饮孤独 提交于 2019-12-17 20:28:22
问题 I have a html form which has Firstname , LastName , Age and Gender and a ADD button. I enter the data into the form and that gets into the Berkeelys db. What my code does is it prints only the last values. I want that it should show all the values related to particular key #!/usr/bin/python import bsddb import cgi form = cgi.FieldStorage() print "Content-type:text/html\n" Fname = form.getvalue('firstname', '') Lname = form.getvalue('lastname', '') Age = form.getvalue('age', 0) Gender = form

How to run cgi script on apache server

◇◆丶佛笑我妖孽 提交于 2019-12-17 20:28:01
问题 This is my program: [root@localhost cgi-bin]# locate first.pl /home/Ram/Desktop/work/first.pl /usr/local/apache2/cgi-bin/first.pl [root@localhost cgi-bin]# cd /usr/local/apache2/cgi-bin/ [root@localhost cgi-bin]# vi first.pl #!/usr/bin/perl -w use warnings; use warnings; use CGI; print "content-type: text/html\n\n"; print "<h2>Hello, World!</h2>\n"; I am calling the script from my browser like this: http://localhost/usr/local/apache2/cgi-bin/first.pl I didn't get output, but I'm getting an

How to run CGI scripts on Nginx

一世执手 提交于 2019-12-17 19:37:35
问题 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 start running automatically Do you have any idea? I'm running Centos 5 I've found some solutions here but I couldn't integrate code given there with this Perl script I'm completely zero at Perl, please help me Thanks 回答1: Nginx is a web server. You

Python CGI - UTF-8 doesn't work

♀尐吖头ヾ 提交于 2019-12-17 18:31:22
问题 For HTML5 and Python CGI: If I write UTF-8 Meta Tag, my code doesn't work. If I don't write, it works. Page encoding is UTF-8. print("Content-type:text/html") print() print(""" <!doctype html> <html> <head> <meta charset="UTF-8"> </head> <body> şöğıçü </body> </html> """) This codes doesn't work. print("Content-type:text/html") print() print(""" <!doctype html> <html> <head></head> <body> şöğıçü </body> </html> """) But this codes works. 回答1: For CGI, using print() requires that the correct

日志分析工具Awstats实战之Nginx篇(分析结果动态化)

二次信任 提交于 2019-12-17 17:38:39
上一篇博文“分析工具Awstats实战之Nginx篇-分析结果静态化 http://www.linuxidc.com/Linux/2013-10/92150.htm”介绍了如何将awstats的日志分析信息用静态页面来进行显示,不过显示效果肯定没有动态的好啦。本篇博文将带大家一起来部署动态的分析结果查阅 。 环境: CentOS 6.4 ip:192.168.1.113 域名:www.linuxidc.com(server和client都通过hosts文件解析) nginx-1.2.9 编译安装,路径/usr/local/nginx,服务开启状态 日志记录格式为nginx默认的,切勿更改,否则会造成awstats无法分析日志。 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; awstats-7.2.tar.gz CPAN-2.00.tar.gz FCGI-0.74.tar.gz FCGI-ProcManager-0.24.tar.gz 必须有perl-devel,不然无法编译FCGI。 一、日志自动切割

Is it correct to use the <style> tag outside of the <head> element?

假如想象 提交于 2019-12-17 16:59:23
问题 Is it correct to use the <style> tag outside of the <head> element ? Like this: <html> <head> <style> some style </style> </head> <body> some text </body> <style> some more style </style> <body> some more text </body> </html> I want to do this because: my cgi sources other files with their own style. The cgi file contains: #!/bin/bash echo "content-type: text/html" echo "" echo "<html><head><style>" echo "h1 {color: red;}" echo "</style>" echo "<body>" echo "<h1> some text here </h1>" echo "<