想在apache裡使用perl寫的cgi...
發表於 : 10/19/2006 1:43 pm
小弟近日很想親近perl,所以想在apache裡使用perl寫的cgi...
我看了冰果室裡apache,perl,cgi等關鍵字的文章,實做後還是碰到一些問題,如下...
寫了一個test.cgi
#!/usr/bin/perl -w
print "Content-type: text/html\r\n\r\n";
print "Hello, World.\n";
我改了apache的 httpd.conf
<Directory "/Library/WebServer/CGI-Executables">
...
Options ExecCGI
...
</Directory>
chmod 755 test.cgi 也作了,甚至777也試過了
結果test.cgi能在 Terminal 裡執行,可以看到 Hello,World
但在 safari 卻回應...
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] 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.33 Server at joshdediannao.local Port 80
查了 /private/var/log/httpd/error_log 如下..
[Thu Oct 19 11:10:14 2006] [error] (8)Exec format error: exec of /Library/WebServer/CGI-Executables/test.cgi failed
[Thu Oct 19 11:10:14 2006] [error] [client 127.0.0.1] Premature end of script headers: /Library/WebServer/CGI-Executables/test.cgi
望前輩高手能指點一下
謝謝[/b]
我看了冰果室裡apache,perl,cgi等關鍵字的文章,實做後還是碰到一些問題,如下...
寫了一個test.cgi
#!/usr/bin/perl -w
print "Content-type: text/html\r\n\r\n";
print "Hello, World.\n";
我改了apache的 httpd.conf
<Directory "/Library/WebServer/CGI-Executables">
...
Options ExecCGI
...
</Directory>
chmod 755 test.cgi 也作了,甚至777也試過了
結果test.cgi能在 Terminal 裡執行,可以看到 Hello,World
但在 safari 卻回應...
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] 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.33 Server at joshdediannao.local Port 80
查了 /private/var/log/httpd/error_log 如下..
[Thu Oct 19 11:10:14 2006] [error] (8)Exec format error: exec of /Library/WebServer/CGI-Executables/test.cgi failed
[Thu Oct 19 11:10:14 2006] [error] [client 127.0.0.1] Premature end of script headers: /Library/WebServer/CGI-Executables/test.cgi
望前輩高手能指點一下
謝謝[/b]
