我正在我的开发机器上运行XAMPP 1.8.1
和Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
来测试我的项目。在我的私人项目和众所周知的引导程序中,我可以选择任何语言( 38种语言中的一种),但不能选择波兰语言。
经过更深入的调查,我发现这是造成的,因为当浏览器试图加载区域设置文件(general.pl.json
,在我的项目和bootstrap-datepicker.pl.js
的情况下,在引导数据报童的情况下)时,服务器(Apache)在500 Internal Server Error
上失败。
在分析Apache error.log
文件之后,我发现正在发生这种情况,因为Apache试图以(可能是Perl)可执行脚本的方式执行该文件:
[win32:error] [pid 5128:tid 1680] [client 127.0.0.1:53455] AH02102: C:/XAMPP/htdocs/mobile/public/pg-demo-bootstrap/locales/general.pl.json is not executable; ensure interpreted scripts have "#!" or "'!" first line, referer: http://127.0.0.1/mobile/public/pg-demo-bootstrap/
[cgi:error] [pid 5128:tid 1680] (9)Bad file descriptor: [client 127.0.0.1:53455] AH01222: don't know how to spawn child process: C:/XAMPP/htdocs/mobile/public/pg-demo-bootstrap/locales/general.pl.json, referer: http://127.0.0.1/mobile/public/pg-demo-bootstrap/
[win32:error] [pid 5128:tid 1644] [client 127.0.0.1:53465] AH02102: C:/XAMPP/htdocs/us/ustv/assets/6dafd2fe/js/locales/bootstrap-datepicker.pl.js is not executable; ensure interpreted scripts have "#!" or "'!" first line, referer: http://127.0.0.1/us/ustv/content/manage/update.html?id=4
[cgi:error] [pid 5128:tid 1644] (9)Bad file descriptor: [client 127.0.0.1:53465] AH01222: don't know how to spawn child process: C:/XAMPP/htdocs/us/ustv/assets/6dafd2fe/js/locales/bootstrap-datepicker.pl.js, referer: http://127.0.0.1/us/ustv/content/manage/update.html?id=4
我做了很多关于更改内容和文件名的测试,使用了许多假文件来假装这个文件(波兰地区),这都带来了混淆,内容不是问题,只有文件名中的.pl
才会带来麻烦。
好的问题是:
.pl
(Perl?)文件名的一部分位于中间,文件名实际上以.js
或.json
结尾。#!
或'!
字符?更好的问题是,如何解决这个问题,这样Apache就可以像所有其他地区文件一样,将这个文件作为一个简单的Javascript来处理了?也不会尝试执行它?
发布于 2013-07-25 20:41:46
在xampp\apache\conf\httpd.conf中,应该有如下一行:
AddHandler cgi-script .cgi .pl .asp
只需按如下方式注释掉这一行:
#AddHandler cgi-script .cgi .pl .asp
重新启动Apache。如果希望保留.cgi和.asp处理程序,只需从行中删除.pl即可。即使您这样做,Perl实际上仍然可以工作。
发布于 2013-09-10 18:47:19
我遇到了同样的问题,前面的答案并没有为我解决这个问题,而是带我到了mime.html#addhandler的Apache,上面写着:
文件名可能有多个扩展,扩展参数将与每个扩展名进行比较。
多个扩展链接指向同一页面上的另一个部分,说明文件可以具有多个扩展名。Ie.:welcome.fr.html
和welcome.html.fr
一样被对待。扩展的顺序与此无关,一个文件名甚至可以包含多种语言,就像在welcome.html.en.de
中一样。其优点是定义的语言在HTTP报头中发送。
仅基于最终扩展的配置处理程序:
<FilesMatch \.pl$>
SetHandler cgi-script pl
</FilesMatch>
为了完成这项工作,我必须首先删除pl
的处理程序:
RemoveHandler pl
发布于 2018-09-19 07:28:06
如果在apache日志中显示以下消息
.js是不可执行的;确保解释的脚本有"#!“
您应该修改配置文件,使用别名而不是ScriptAlias,如下所示:
别名/bugzilla/ "C:/bugzilla/“
并在apache中的别名行后面添加下面的代码段。
ScriptInterpreterSource注册表-严格的AddHandler cgi-脚本.cgi选项+ExecCGI +FollowSymLinks index.cgi index.html AllowOverride限制FileInfo索引选项AuthConfig都需要授予
https://stackoverflow.com/questions/17671830
复制相似问题