【发布时间】:2013-07-14 08:32:21
【问题描述】:
我在我的开发机器上运行XAMPP 1.8.1 和Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 来测试我的项目。在我的私人项目和众所周知的 Bootstrap Datepicker 组件中,我可以选择任何语言(在 datepicker 的情况下为 38 种语言之一)但不能选择波兰语。
经过深入调查,我发现这是由于当浏览器尝试加载语言环境文件时(general.pl.json,在我的项目中,bootstrap-datepicker.pl.js,在 Bootstrap Datepicker 的情况下),服务器(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 有问题。
好问题是:
为什么 Apache 声称,这是脚本,虽然
.pl(Perl?)文件名的一部分在中间,而且文件名实际上以.js或.json结尾?-
为什么 Apache for Windows 尝试执行 Linux/Unix/Bash 脚本并在其第一行中寻找
#!或'!字符?
更好的问题是,如何解决这个问题,以便 Apache 开始将此文件视为简单的 Javascript,就像所有其他语言环境文件一样?并且不会尝试执行它?
【问题讨论】:
标签: javascript apache xampp executable