為什麼無法進入cgi-bin????



贊助商連結


bentong
2001-09-29, 02:19 AM
我是用Apache+PHP+Perl+MySQL在Windows下架設的伺服器,
也修改了httpd.conf檔---> 把cgi-bin指到正確路徑, 並把option 設為ExecCGI可是當我在URL輸入 http://localhost/cgi-bin/test.cgi 作測試時
卻出現
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
---------------------------------------------------------------------------

Apache/1.3.14 Server at localhost Port 80

後來我又在Linux CLE1.0下重新架設, 其結果還是一樣, 我檢查檔案屬性, 都開成777啦, 為何還是無法執行???
為了確定錯誤訊息在表達什麼,我故意輸入一個不存在的檔案:http://localhost/cgi-bin/not.cgi
結果出現:
404 找不到網頁
查詢的網頁可能已經移除、重新命名或者暫時無法使用。

-------------------------------------------------------------------------------

那就表示說先前apache可以定位到我的cgi-bin/test.cgi, 只是它無法執行 我還必須設定與perl有關的參數嗎??? 可是書上都沒提到說??

贊助商連結


bentong
2001-09-29, 02:34 AM
後來我把phpNuke架起來,Server都正常沒問題(可以跑.php 和 .html啦)
於是我把一個index.html 拷貝到cgi-bin的路徑下,然後打http://localhost/cgi-bin/index.html(很簡單的html)
結果還是
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
-------------------------------------------------------------------------------

Apache/1.3.14 Server at localhost Port 80
這表示程式本身也沒錯, 那剩下的就是misconfiguration
但是哪裡還需要設定呢???????
請大家幫忙腦力激盪一下
THANKS

bentong
2001-09-29, 03:13 AM
終於讓我找到error log :
----------------------------------------------------------------------------
Apache server shutdown initiated...
[Sat Sep 29 01:46:38 2001] [error] [client 127.0.0.1] attempt to invoke directory as script: /apache/cgi-bin
[Sat Sep 29 01:46:59 2001] [error] [client 127.0.0.1] (2)No such file or directory: script not found or unable to stat: /apache/cgi-bin/index.htm
[Sat Sep 29 01:47:04 2001] [error] [client 127.0.0.1] /apache/cgi-bin/index.html is not executable; ensure interpreted scripts have "#!" first line
[Sat Sep 29 01:47:04 2001] [error] [client 127.0.0.1] couldn't spawn child process: /apache/cgi-bin/index.html
[Sat Sep 29 02:03:12 2001] [error] [client 127.0.0.1] couldn't spawn child process: /apache/cgi-bin/test.cgi

bentong
2001-09-29, 03:25 AM
為什麼無法執行test.cgi, 好,把程式碼叫出來看一下 :
原來問題就出在第一行
#!/usr/bin/perl
########################################################
# 環境變量探針 #
# 您只須將程序上傳,再修改文件屬性為“755”即可使用。 #
# 如:chmod 755 http://www.web263.com #
########################################################
## 以下部分不需修改 ##
######################
print "Content-type:text/html\n\n";
.
.
.
(以下省略)
----------------------------------------------------------------
我本來是要架LB5000, 這個程式好像不多人用,而且先拿來在Win32的平台上試,
索性就把第一行改成:
#!\apache\Perl\bin\MSWin32-x86\perl.exe

結果居然成功了?!^^
-----------------------------------------
環境變量探針

當前目錄的CGI程式文件的絕對路徑 /apache/cgi-bin
當前目錄的CGI腳本文件的URL相對路徑 http://localhost/cgi-bin
Perl 版本 5.00503
當前操作系統 MSWin32
您的絕對路徑是否要填 絕對路徑不用填
--------------------------------------------

bentong
2001-09-29, 03:32 AM
1.跨平台絕對是趨勢<----這還用說
2.發問題前該自己先研究一下<----版主別K我灌水,我做了一個示範教材
3.開放原始碼就是讓大家用的更方便<---永遠支持開放原始碼社團
Thanks All