Windows上的Apache更改CGI解释器

Windows上的Apache更改CGI解释器,apache,jscript,Apache,Jscript,我正在尝试运行我的jscript文件,并使用CGI将结果返回给客户机。但是我不能像#那样设置第一行og mys脚本/usr/bin/cscript.exe,因为jscript不支持以#开头的注释,并且get错误 问题:我如何设置CGI解释器的路径#/usr/bin/cscript.exe在我的脚本的第一行中?来自我相当陈旧的httpd.conf: # However, Apache on Windows allows either the Unix behavior above, or can

我正在尝试运行我的jscript文件,并使用CGI将结果返回给客户机。但是我不能像#那样设置第一行og mys脚本/usr/bin/cscript.exe,因为jscript不支持以#开头的注释,并且get错误


问题:我如何设置CGI解释器的路径#/usr/bin/cscript.exe在我的脚本的第一行中?

来自我相当陈旧的httpd.conf:

# However, Apache on Windows allows either the Unix behavior above, or can
# use the Registry to match files by extention.  The command to execute 
# a file of this type is retrieved from the registry by the same method as 
# the Windows Explorer would use to handle double-clicking on a file.
# These script actions can be configured from the Windows Explorer View menu, 
# 'Folder Options', and reviewing the 'File Types' tab.  Clicking the Edit
# button allows you to modify the Actions, of which Apache 1.3 attempts to
# perform the 'Open' Action, and failing that it will try the shebang line.
# This behavior is subject to change in Apache release 2.0.
#
# Each mechanism has it's own specific security weaknesses, from the means
# to run a program you didn't intend the website owner to invoke, and the
# best method is a matter of great debate.
#
# To enable the this Windows specific behavior (and therefore -disable- the
# equivilant Unix behavior), uncomment the following directive:
#
#ScriptInterpreterSource registry
因此,我启用了ScriptExplorerSource功能,选中:

ftype JSFile
JSFile=%SystemRoot%\System32\CScript.exe "%1" %*
并使用
c:\program\xampp\cgi-bin\jscgi.js
包含:

WScript.Echo("Content-Type: text/html\n");
WScript.Echo("OK:", WScript.ScriptFullName, new Date());
成功。我没有接触其他设置,如AddHandler、directory或 ScriptAlias,我刚刚测试了phpinfo.php和printenv.pl,看看这是否正确 更改公然破坏了我的安装-不

你应该谨慎得多

更新wrt注释:


根据2.4文档(搜索“ScriptExplorerSource”),该指令仍然有效。您确定apache用户帐户将.js文件与cscript.exe相关联吗?

您使用哪个版本的apache?我正在Apache/2.4.4上尝试相同的设置,但不起作用