我已经编写了一个简单的HTML代码,在提交时,它将执行一个bash脚本。脚本位于正确的文件夹(cgi-bin)中。当我在firefox上加载这个页面时。它给出一个错误,如下所示
/somePATH/cgi-bin/script.sh could not be opened because an unknown error occurred.
是脚本权限的问题吗?我试过了:
chmod 777
下面是HTML代码的一部分。
<form action="cgi-bin/script.sh" method="post">
<input type=
我编写了一个CGI脚本,它使用bash执行MySQL查询。对于MySQL身份验证,通过在.my.cnf文件中提供凭据使用自动登录,如下所示。
# the following section will be read by *all* client programs
[client]
user=dbuser
password=password
因为CGI程序是以apache用户的身份执行的,所以我将.my.cnf放在apache的主目录下。
# grep apache /etc/passwd
apache:x:48:48:Apache:/var/www:/sbin/nologin
#
在我的脚本中引用倒数第二行。由于某些原因,Perl不能访问变量$perlPort,我该如何解决这个问题呢?注意:$perlPort是一个bash变量,位于我的perl脚本之前
perl -e '
{
package MyWebServer;
use HTTP::Server::Simple::CGI;
use base qw(HTTP::Server::Simple::CGI);
my %dispatch = (
"/" => \&resp_hello,
);
sub handle_req