cgi

How can I set Perl's inclusion path for modules for a CGI script?

笑着哭i 提交于 2019-12-01 16:11:20
I’ve got several Perl modules installed on my hosting machine in ~/perl , how do I add them to Perl module path? Setting PERL5LIB or unshift ing the paths to @INC surely works, but the environment variable does not help when running as a CGI script and the @INC way is not very portable. Is there a better way? This has to be a common problem, am I missing something? brian d foy PERL5LIB works just fine for CGI scripts. You just have to set the variable in the right place, such as the server configuration. Which webserver are you using? For Apache, I use the SetEnv directive from mod_env. @INC

Apache [PTY Errors] in cgi-perl file while creating a new Expect object

强颜欢笑 提交于 2019-12-01 14:21:31
I have a perl script: #!/usr/bin/perl -w use DateTime; use Expect; use IO::Pty; use CGI::Fast; while($q = new CGI::Fast){ my $ip = $q->param('ip'); my $folder = $q->param('folder'); my $username = $q->param('username'); my $password = $q->param('password'); print "Content-type: text/html\r\n\r\n"; print "<head>\n<title>FastCGI</title>\n\</head>"; print "<h3> $ip - $folder - $username - $password </h3>"; my $ssh = new Expect; if($ssh->spawn("ssh -q -l $username $ip")){ print "<h4>Connexion OK</h4>"; } else { print "Error\n"; die "Connexion failed, $!"; } } The execution of this script create

Running a perl cgi as root with *proper* security

与世无争的帅哥 提交于 2019-12-01 12:58:58
I've the need to run one Perl cgi as root. I already understand most of the security concerns of doing this but let me explain first. The Perl cgi could run as the web server but would require sudo access to run some commands. This is what I've done first but this doesn't only allow that cgi to run these commands but the whole user running the web server. Also, instead of running commands with sudo, I would prefer to use native library that are way faster than running external commands. However, these native library requires root access for some of the operations. So what I had in mind was to

cgi and tomcat

岁酱吖の 提交于 2019-12-01 12:42:50
im trying to run a cgi script (.cgi) with tomcat. I am getting the below error and cant find out whats wrong. I know i should really use apache and mod proxy but this really isnt my area of expertise so im taking the easy way out! Thanks for any help. java.io.IOException: Cannot run program "perl" (in directory "C:\Java\tomcat\webapps\my_app_name\WEB-INF\cgi"): CreateProcess error=2, The system cannot find the file specified java.lang.ProcessBuilder.start(ProcessBuilder.java:459) java.lang.Runtime.exec(Runtime.java:593) java.lang.Runtime.exec(Runtime.java:431) org.apache.catalina.servlets

cgi and tomcat

不问归期 提交于 2019-12-01 12:26:42
问题 im trying to run a cgi script (.cgi) with tomcat. I am getting the below error and cant find out whats wrong. I know i should really use apache and mod proxy but this really isnt my area of expertise so im taking the easy way out! Thanks for any help. java.io.IOException: Cannot run program "perl" (in directory "C:\Java\tomcat\webapps\my_app_name\WEB-INF\cgi"): CreateProcess error=2, The system cannot find the file specified java.lang.ProcessBuilder.start(ProcessBuilder.java:459) java.lang

How set an environment variable in PHP with Apache/FastCGI?

…衆ロ難τιáo~ 提交于 2019-12-01 11:09:59
I need to define an environment variable named SQLANY17 and this variable should be available in PHP (i.e. under "Environment" in the standard phpinfo() page). PHP is executed via FastCGI and I'm running CentOS 7 x64, Apache 2.4.6 and PHP 5.5.30. I've edited /etc/httpd/conf.d/fcgid.conf which already exists in my distribution. According to the documentation an environment can be defined using FcgidInitialEnv. <IfModule mod_fcgid.c> # ... FcgidInitialEnv SQLANY17 /opt/sqlanywhere17 </IfModule> However this doesn't work, even after a full machine reboot. Any ideas? I'm sure the fcgid.conf is

Running python script from php

懵懂的女人 提交于 2019-12-01 11:07:55
I am trying to run a python script from php. exec("../cgi-bin/form.py", $output); var_dump($output); I'm certain the path is correct, and that form.py is executable. this is form.py #!/usr/bin/env python print "IN form.py' However, this prints out NULL. I don't think the script is being executed. How do I make sure it is? You're literally just typing in the location of the file. You need to tell exec to execute python with that script. exec("python ../cgi-bin/form.py", $output); 来源: https://stackoverflow.com/questions/10937487/running-python-script-from-php

Python Web部署方式总结

廉价感情. 提交于 2019-12-01 11:02:58
学过PHP的都了解,php的正式环境部署非常简单,改几个文件就OK,用FastCgi方式也是分分钟的事情。相比起来,Python在web应 用上的部署就繁杂的多,主要是工具繁多,主流服务器支持不足,在了解Python的生产环境部署方式之前,先明确一些概念!很重要! CGI:   CGI即通用网关接口(Common Gateway Interface),是外部应用程序(CGI程序)与Web服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的规程。CGI规范允许 Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将Web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体。通俗的讲CGI 就像是一座桥,把网页和WEB服务器中的执行程序连接起来,它把HTML接收的指令传递给服务器的执行程序,再把服务器执行程序的结果返还给HTML页。 CGI 的跨平台性能极佳,几乎可以在任何操作系统上实现。   CGI方式在遇到连接请求(用户请求)先要创建cgi的子进程,激活一个CGI进程,然后处理请求,处理完后结束这个子进程。这就是fork- and-execute模式。所以用cgi方式的服务器有多少连接请求就会有多少cgi子进程,子进程反复加载是cgi性能低下的主要原因。当用户请求数 量非常多时,会大量挤占系统的资源如内存,CPU时间等,造成效能低下。 CGI脚本工作流程

Python3 CGI HTTPS server fails on Unix

拈花ヽ惹草 提交于 2019-12-01 10:35:18
问题 This Python3 CGI HTTPS server used to work a few weeks (or months) ago, but now no longer works under Linux (Ubuntu). I tried on Ubuntu 10.04 and Ubuntu 14.04 and the behavior is the same. Now when I try to access any CGI script I am getting: Secure Connection Failed An error occurred during a connection to 127.0.0.1:4443. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long) Below is the code for the server: import http.server import

Why is my image download CGI script written in Perl not working?

徘徊边缘 提交于 2019-12-01 09:35:15
#!/usr/bin/perl use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser); my $files_location; my $ID; my @fileholder; $files_location = "C:\Users\user\Documents\hello\icon.png"; open(DLFILE, "<$files_location") ; @fileholder = <DLFILE>; close (DLFILE) ; print "Content-Type:application/x-download\n"; print "Content-Disposition:attachment;filename=$ID\n\n"; print @fileholder; When I run this script, instead of returning the icon.png file it returns the download.pl (the name of the script given above) with no content inside it. What is the issue? Script i am using currently. #!C:\Perl64\bin\perl