简体   繁体   English

从HTML运行CGI脚本

[英]Running a CGI script from HTML

I have an HTML form like so: 我有这样的HTML表单:

<form method="post" action="./cgi-bin/login.cgi">

Clicking the submit button of this form should run the CGI file, but it displays the CGI file in the browser instead. 单击此表单的提交按钮应运行CGI文件,但它将在浏览器中显示CGI文件。 Here are the contents of login.cgi: 以下是login.cgi的内容:

#!/bin/sh java Login

This is all running on an Apache-Tomcat server. 这些都在Apache-Tomcat服务器上运行。

What am I missing? 我想念什么? Do I need to specifically configure the server to run CGI? 我是否需要专门配置服务器以运行CGI?

Your server is probably not configured to run cgi scripts. 您的服务器可能未配置为运行cgi脚本。

AddHandler cgi-script cgi pl
<Directory /path/to/cgi/files>
    Options +ExecCGI
</Directory>

Also, Make sure that apache loading the cgi module in httpd.conf 另外,请确保apache在httpd.conf中加载cgi模块

LoadModule cgi_module modules/mod_cgi.so

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM