我正在尝试在运行GNU / Linux Debian Stable机器的apache2服务器上运行Rebol CGI脚本。
这是我的Rebol脚本:
# pierre@autan: ~$ < 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)"
失败了:
# pierre@autan: ~$ < 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, webmaster@localhost 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 > root@autan:/#
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
阅读文档(http://httpd.apache.org/docs/trunk/fr/howto/cgi.html)后,我可以成功运行此Perl脚本:
# pierre@autan: ~$ < 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可执行文件的路径是正确的:我可以直接从shell启动脚本而不显式调用解释器:
# pierre@autan: ~$ < 2013_05_30__14_07_36 >
/usr/lib/cgi-bin/test.cgi
Content-type: text/html
coucou! (signé: Rebol)
执行权对我来说似乎很好;它们对于两个文件都是相同的:
# pierre@autan: ~$ < 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
Rebol可执行文件的执行权对我来说似乎很好:
# pierre@autan: ~$ < 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 / View 2.7.8.4.2 2011年1月2日。
这是我修改过的apache2配置文件:
###ROOT### < 29/05/2013 17:20:12 > root@autan:/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配置并不熟悉。
有什么想法吗?
答案 0 :(得分:3)
您是否尝试过使用Rebol / Core版本?
Rebol / View需要访问图形系统,即使它只是打印文本,也许这在通过Apache启动时是不可能的。
(例如,如果您在文本控制台上启动Rebol / View,则会出现错误)
亲切的问候,
英戈
答案 1 :(得分:0)
我想我也可以把解决方案放在这里,为了完整起见。 我只是按照Ingo的建议。这是我的终端的一个愚蠢的副本,显示所有步骤:
# pierre@autan: ~$ < 2013_05_30__19_52_58 >
cd rebol/telech/
# pierre@autan: ~/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]
# pierre@autan: ~/rebol/telech$ < 2013_05_30__19_52_58 >
tar zxf rebol-core-278-4-2.tar.gz
# pierre@autan: ~/rebol/telech$ < 2013_05_30__19_52_58 >
su
Mot de passe :
###ROOT### < 30/05/2013 19:55:06 > root@autan:/home/pierre/rebol/telech#
cp releases/rebol-core/rebol /usr/bin/rebol_core
###ROOT### < 30/05/2013 19:55:06 > root@autan:/home/pierre/rebol/telech#
chmod a+x /usr/bin/rebol_core
###ROOT### < 30/05/2013 19:55:06 > root@autan:/home/pierre/rebol/telech#
vi /usr/lib/cgi-bin/test.cgi
###ROOT### < 30/05/2013 19:55:06 > root@autan:/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 > root@autan:/home/pierre/rebol/telech#
# pierre@autan: ~/rebol/telech$ < 2013_05_30__19_52_58 >
lynx http://127.0.0.1/cgi-bin/test.cgi
coucou! (signé: Rebol)
=&GT;它有效!
我不希望将core作为我的默认Rebol解释器,这就是为什么我更喜欢将它明确命名为rebol_core。这样/ usr / bin / rebol仍然是rebol / view解释器。
非常感谢Ingo!