获取 Perl CGI 脚本的空白屏幕
Getting Blank Screen for Perl CGI Script
网页上的以下 Perl CGI 脚本出现黑屏。
脚本在终端上执行得很好,但是当我从网络浏览器 运行 它是空白的。请帮忙。
当我将 Web 内容移动到页面顶部时,这会起作用。基本上我在数据库连接后放置的任何内容都不会显示在网络浏览器上。
OS : Unix
Apache2 网络服务器
注意:脚本有执行权限
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use CGI;
print "Content-type: text/html\n\n";
# Simple HTML code follows
my $driver= "Oracle";
my $dsn = "DBI:$driver:sid=xxxxx;host=xxxxx;port=1521";
my $dbh = DBI->connect($dsn,'xxxx','xxxx');
#print $dbh;
my $sth = $dbh->prepare("SELECT * FROM TABLE WHERE ROWNUM <= 10");
$sth->execute;
print "<html> <head>\n";
print "<title>Hello, world!</title>";
print "</head>\n";
print "<body>\n";
print "<h1>Hello, world!</h1>\n";
print "<p>The Details are as follows:</p>\n";
print "<table cols=5 border=1>\n";
print "<tr>\n";
print "<th>ACTION</th>\n";
print "<th>ALARM_TEXT</th>\n";
print "<th>ALARM_SEV</th>\n";
print "<th>EMS_NAME</th>\n";
print "</tr>";
while( my $ref = $sth->fetchrow_hashref() ) {
print "<tr>\n";
print "<td>", $ref->{'ACTION'}, "</td>\n";
print "<td>", $ref->{'ALARM_TEXT'}, "</td>\n";
print "<td>", $ref->{'ALARM_SEV'}, "</td>\n";
print "<td>", $ref->{'EMS_NAME'}, "</td>\n";
print "</tr>\n";
}
print "</table>\n";
print "<h1>Hello, world!</h1>\n";
print "</body> </html>\n";
通过将以下行添加到 httdd.conf 文件来修复它。
SetEnv ORACLE_HOME /oracle/app/oracle/product/11.2.0.4/db_1
网页上的以下 Perl CGI 脚本出现黑屏。 脚本在终端上执行得很好,但是当我从网络浏览器 运行 它是空白的。请帮忙。
当我将 Web 内容移动到页面顶部时,这会起作用。基本上我在数据库连接后放置的任何内容都不会显示在网络浏览器上。
OS : Unix Apache2 网络服务器
注意:脚本有执行权限
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use CGI;
print "Content-type: text/html\n\n";
# Simple HTML code follows
my $driver= "Oracle";
my $dsn = "DBI:$driver:sid=xxxxx;host=xxxxx;port=1521";
my $dbh = DBI->connect($dsn,'xxxx','xxxx');
#print $dbh;
my $sth = $dbh->prepare("SELECT * FROM TABLE WHERE ROWNUM <= 10");
$sth->execute;
print "<html> <head>\n";
print "<title>Hello, world!</title>";
print "</head>\n";
print "<body>\n";
print "<h1>Hello, world!</h1>\n";
print "<p>The Details are as follows:</p>\n";
print "<table cols=5 border=1>\n";
print "<tr>\n";
print "<th>ACTION</th>\n";
print "<th>ALARM_TEXT</th>\n";
print "<th>ALARM_SEV</th>\n";
print "<th>EMS_NAME</th>\n";
print "</tr>";
while( my $ref = $sth->fetchrow_hashref() ) {
print "<tr>\n";
print "<td>", $ref->{'ACTION'}, "</td>\n";
print "<td>", $ref->{'ALARM_TEXT'}, "</td>\n";
print "<td>", $ref->{'ALARM_SEV'}, "</td>\n";
print "<td>", $ref->{'EMS_NAME'}, "</td>\n";
print "</tr>\n";
}
print "</table>\n";
print "<h1>Hello, world!</h1>\n";
print "</body> </html>\n";
通过将以下行添加到 httdd.conf 文件来修复它。
SetEnv ORACLE_HOME /oracle/app/oracle/product/11.2.0.4/db_1