【发布时间】:2020-09-30 12:59:15
【问题描述】:
我在 cgi-bin 文件夹中有一个名为 helo.jar 的可执行 jar 文件和一个 hello.sh
这是我的脚本
#!/bin/bash
java -jar helo.jar
我试图通过这个网址“http://localhost/cgi-bin/hello.sh”运行这个脚本
遇到内部服务器错误,并检查日志并显示“在标头之前结束脚本输出”
我正在使用可以执行 java 命令的 docker wordpress 容器,而且我是 cgi 程序的新手。
这是我的 Java 代码
public static void main( String args[] )
{
// Here is a minimalistic CGI program that uses cgi_lib
// Print the required CGI header.
System.out.println(cgi_lib.Header());
// Parse the form data into a Hashtable.
Hashtable form_data = cgi_lib.ReadParse(System.in);
// Create the Top of the returned HTML page
System.out.println("Here are the name/value pairs from the form:");
// Print the name/value pairs sent from the browser.
System.out.println(cgi_lib.Variables(form_data));
System.out.println("Nome: " + form_data.get("name"));
System.out.println("<p>");
System.out.println("Email: " + form_data.get("email"));
System.out.println("<p>");
System.out.println(cgi_lib.HtmlBot());
}
我确定我的错误在我的脚本中,因为我已经尝试过其他脚本并且它工作正常,例如 perl
【问题讨论】:
标签: bash sh cgi executable-jar cgi-bin