請幫我看看我的cgi有沒有寫錯??

看板Perl作者時間20年前 (2004/12/04 20:26), 編輯推噓4(400)
留言4則, 3人參與, 最新討論串1/1
#!/usr/local/bin/perl use lib "$home/xxx"; use CGI; use strict; use Template; my $q=new CGI; print $q->header(-charset => 'utf-8'); print $q->start_html("hello"); my $config= { INCLUDE_PATH => ".", eval_perl =>1, }; my $template=Template->new($config); my $replace="Hello你好阿!!"; my $vars= { var =>$replace, }; my $temp_file="template.htm"; my $output=""; $template->process($temp_file,$vars,$output) or die $template->error(); print $output; print $q->end_html(); 以下是template.htm的檔案 仔細看喔[% var %] 那個pl的檔案在console下都可以正常執行 不過拿來當做cgi就會出現500的錯誤 請問到底錯在哪裡呢?? 謝謝~ (ps. 別的perl程式都可以正常執行 所以應該不是權限等等設定錯誤~~) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.62.97.25

221.169.96.188 12/04, , 1F
你有 "Content-type..." 嗎?!
221.169.96.188 12/04, 1F

61.62.97.25 12/05, , 2F
print $q->header(); 就會自動輸出啦
61.62.97.25 12/05, 2F

140.116.131.114 12/10, , 3F
最後加個"1;"看看
140.116.131.114 12/10, 3F

61.62.97.25 12/10, , 4F
ok...我試試看~~
61.62.97.25 12/10, 4F
文章代碼(AID): #11iQpwqt (Perl)
文章代碼(AID): #11iQpwqt (Perl)