2013-05-30 40 views
1

我試圖在運行於GNU/Linux Debian Stable機器上的apache2服務器上運行Rebol CGI腳本。如何在apache2上執行Rebol CGI腳本

這裏是我的雷博爾腳本:

# [email protected]: ~$  <2013_05_29__17_35_22> 
dog /usr/lib/cgi-bin/test.cgi 
#!/usr/bin/rebol -cs 
REBOL [] 
print "Content-type: text/html^/" 
print "coucou! (signé: Rebol)" 

其失敗:

# [email protected]: ~$  <2013_05_29__17_21_18> 
lynx http://127.0.0.1/cgi-bin/test.cgi 

回報:

             500 Internal Server Error 
          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/2.2.22 (Debian) Server at 127.0.0.1 Port 80 

日誌說:

###ROOT### < 29/05/2013 17:02:45 > [email protected]:/# 
tail -1 /var/log/apache2/error.log 
[Thu May 30 15:04:23 2013] [error] [client 127.0.0.1] Premature end of script headers: test.cgi 

讀取DOC(http://httpd.apache.org/docs/trunk/fr/howto/cgi.html)後,我可以成功運行此Perl腳本:

# [email protected]: ~$  <2013_05_29__17_35_22> 
dog /usr/lib/cgi-bin/testpl.cgi 
#!/usr/bin/perl 
print "Content-type: text/html\n\n"; 
print "coucou! (signé: Perle)"; 

現在,我想知道什麼不順心與Rebol的腳本...

我查了幾件事情:

到Rebol的可執行文件的路徑是正確的:我可以啓動腳本,而不顯式調用解釋器,直接從外殼:

# [email protected]: ~$  <2013_05_30__14_07_36> 
/usr/lib/cgi-bin/test.cgi 
Content-type: text/html 


coucou! (signé: Rebol) 

執行權似乎對我很好;它們是相同的兩個文件:

# [email protected]: ~$  <2013_05_29__17_35_22> 
ll /usr/lib/cgi-bin/test*.cgi 
-rwxr-xr-x 1 root root 97 mai 29 09:28 /usr/lib/cgi-bin/test.cgi 
-rwxr-xr-x 1 root root 87 mai 29 09:26 /usr/lib/cgi-bin/testpl.cgi 

爲雷博爾可執行文件的執行權似乎沒什麼問題:

# [email protected]: ~$  <2013_05_30__14_07_36> 
ll /usr/bin/rebol 
-rwxr-xr-x 1 root root 1215652 déc. 30 22:50 /usr/bin/rebol 

我使用REBOL /查看2.7.8.4.2 2-JAN-2011。

下面是我修改的Apache2配置文件:

###ROOT### < 29/05/2013 17:20:12 > [email protected]:/etc/apache2/conf.d# 
dog /etc/apache2/conf.d/httpd.conf 
#ScriptAlias magic/cgi-bin/ /var/www/magic/cgi-bin/ 
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
AddHandler cgi-script .cgi 
Options 

AddHandler magic .rhtml 
Action magic /cgi-bin/magic.cgi 

<Directory "/var/www/magic/cgi-bin/"> 
     AllowOverride None 
     Options ExecCGI MultiViews SymLinksIfOwnerMatch 
     Order allow,deny 
     Allow from all 
</Directory> 

<Directory "/usr/lib/cgi-bin/"> 
     AllowOverride None 
     Options ExecCGI MultiViews SymLinksIfOwnerMatch 
     Order allow,deny 
     Allow from all 
</Directory> 

請注意,我不熟悉,在所有與Apache的配置。

有什麼想法?

回答

3

您是否嘗試過使用Rebol/Core版本?

即使只是打印文本,Rebol/View也需要訪問圖形系統,並且這可能在通過Apache啓動時無法實現。

(你會得到一個錯誤,如果一個文本的控制檯上啓動雷博爾/瀏覽等)

親切的問候,

英戈

+0

它的工作! 謝謝! :) – Pierre

0

我想我可能也把這裏的解決方案,爲了完整起見。 我只是遵循Ingo的建議。這裏是我的終端愚蠢的副本,顯示所有步驟:

# [email protected]: ~$  <2013_05_30__19_52_58> 
cd rebol/telech/ 

    # [email protected]: ~/rebol/telech$  <2013_05_30__19_52_58> 
wget http://www.rebol.com/downloads/v278/rebol-core-278-4-2.tar.gz 
--2013-05-30 19:53:27-- http://www.rebol.com/downloads/v278/rebol-core-278-4-2.tar.gz 
Résolution de www.rebol.com (www.rebol.com)... 205.134.252.23 
Connexion vers www.rebol.com (www.rebol.com)|205.134.252.23|:80...connecté. 
requête HTTP transmise, en attente de la réponse...200 OK 
Longueur: 224394 (219K) [application/x-gzip] 
Sauvegarde en : «rebol-core-278-4-2.tar.gz» 

100%[============================================================================================================================================>] 224,394  127K/s ds 1.7s  

2013-05-30 19:53:29 (127 KB/s) - «rebol-core-278-4-2.tar.gz» sauvegardé [224394/224394] 


    # [email protected]: ~/rebol/telech$  <2013_05_30__19_52_58> 
tar zxf rebol-core-278-4-2.tar.gz 

    # [email protected]: ~/rebol/telech$  <2013_05_30__19_52_58> 
su 
Mot de passe : 
###ROOT### < 30/05/2013 19:55:06 > [email protected]:/home/pierre/rebol/telech# 
cp releases/rebol-core/rebol /usr/bin/rebol_core 
###ROOT### < 30/05/2013 19:55:06 > [email protected]:/home/pierre/rebol/telech# 
chmod a+x /usr/bin/rebol_core 
###ROOT### < 30/05/2013 19:55:06 > [email protected]:/home/pierre/rebol/telech# 
vi /usr/lib/cgi-bin/test.cgi 
###ROOT### < 30/05/2013 19:55:06 > [email protected]:/home/pierre/rebol/telech# 
dog /usr/lib/cgi-bin/test.cgi 
#!/usr/bin/rebol_core -cs 
REBOL [] 
print "Content-type: text/html^/^/" 
print "coucou! (signé: Rebol)" 

###ROOT### < 30/05/2013 19:55:06 > [email protected]:/home/pierre/rebol/telech# 

    # [email protected]: ~/rebol/telech$  <2013_05_30__19_52_58> 
lynx http://127.0.0.1/cgi-bin/test.cgi 


    coucou! (signé: Rebol) 

=>它的工作!

我不想將核心作爲默認的Rebol解釋器,這就是爲什麼我更喜歡將它明確命名爲rebol_core。所以/ usr/bin/rebol仍然是rebol/view解釋器。

非常感謝,Ingo!