小傑 | about CGI & debug【求助】 各位大大! 小弟最近在寫CGI, 我用的Web server 是thttpd, 寫CGI的tool是C language, 小弟遇到了幾個瓶頸,browser按了個submit的鍵後, Web server處理CGI程式, Server會丟字串回去給browser, 但browser顯示出來是空白的網頁, 我用sniffer去捉傳回的封包,發現回傳的封包是空白的, 裡面也沒有記錄thttpd server版本, 我的"猜測"如下: 1.是CGI程式錯誤, 或Web server根本沒處理CGI程式, 或有處理後沒將CGI處理後的結果傳回給browser, 我試著用GDB去debug程式, 但程式是沒問題的, 有沒有大大試過在Linux上捉web server處理封包的軟體, 我試過去browser在web server放CGI的目錄/cgi-bin, 裡面我放文字檔, html檔, 和CGI的檔, 我點選後文字檔和html檔都在client的browser可以show出, 但CGI檔打開了就是空白 2.我的web server(Thttpd)沒架好, 導致沒去處理CGI的程式 小弟我附上我的程式和thttpd.conf及thttpd.log請各位大大能幫幫我! 感恩! Hello.c程式如下: #include <stdio.h> int main( int argc, char** argv ) { fputs( "Content-type: text/plain\n\nHello.\n", stdout ); exit( 0 ); } thttpd.conf如下: # BEWARE : No empty lines are allowed! # This section overrides defaults dir=/var/www chroot cgipat=**.cgi logfile=/var/www/logs/thttpd.log pidfile=/var/run/thttpd.pid # This section _documents_ defaults in effect # port=80 # nosymlink # default = !chroot # novhost # nocgipat # nothrottles # host=0.0.0.0 #charset=iso-8859-1 thttpd.log如下: 192.168.0.146 - - [09/Apr/2003:16:56:27 +0800] "GET /cgi-bin/hello_cgi.cgi HTTP/1.1" 200 50000 "http://192.168.0.147/cgi-bin/" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; KKman2.0)" |
回覆 |
|
類似的主題 | ||||
主題 | 主題作者 | 討論版 | 回覆 | 最後發表 |
【求助】請問那裡空間可以架PHP,CGI????? | 小蔡 | ☉ -- 架 站 DIY 討 論 版 | 1 | 2002-03-22 11:44 PM |
CGI 如何使用 | parnell | -- 網 路 技 術 版 | 0 | 2002-03-02 08:10 PM |
XML | RSS 2.0 | RSS |
本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。