以 html 形式召回时未找到简单的 cgi "Hello World"
Simple cgi "Hello World" not found when recalled in a html form
我有这个简单的 .html 表格
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="/cgi-bin/test">
<input type="text" placeholder="Your name here">
<input type="submit" value="Conferma">
</form>
</body>
</html>
应该记得我 /usr/lib/cgi-bin
位置的 CGI 程序。
很遗憾,出现错误:
Error: your file was not found
即使文件实际上在我的文件夹中:
Present in the directory
注意CGI程序是用C写的,很简单:
#include <stdio.h>
int main() {
printf("Content-type:text/plain\n\n");
printf("Hello World!\n");
return 0;
}
- 哪里出了问题?
第三张图片中的第一个标签显示 file:///cgi-bin/test?
。
这表明找不到的不是服务器上的CGI
但是本地文件 /cgi-bin/test
.
要解决这个问题,您有两个选择:
- 将HTML文件放在CGI所在的服务器上,作为CGI同一个站点访问
- 将 HTML 表格中的
action
从 /cgi-bin/test
更改为 http://192.168.1.18/cgi-bin/test
。
我有这个简单的 .html 表格
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="/cgi-bin/test">
<input type="text" placeholder="Your name here">
<input type="submit" value="Conferma">
</form>
</body>
</html>
应该记得我 /usr/lib/cgi-bin
位置的 CGI 程序。
很遗憾,出现错误: Error: your file was not found
即使文件实际上在我的文件夹中: Present in the directory
注意CGI程序是用C写的,很简单:
#include <stdio.h>
int main() {
printf("Content-type:text/plain\n\n");
printf("Hello World!\n");
return 0;
}
- 哪里出了问题?
第三张图片中的第一个标签显示 file:///cgi-bin/test?
。
这表明找不到的不是服务器上的CGI
但是本地文件 /cgi-bin/test
.
要解决这个问题,您有两个选择:
- 将HTML文件放在CGI所在的服务器上,作为CGI同一个站点访问
- 将 HTML 表格中的
action
从/cgi-bin/test
更改为http://192.168.1.18/cgi-bin/test
。