tre*_*der 5 javascript apache xampp executable
我正在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
Run Code Online (Sandbox Code Playgroud)
我做了很多关于更改内容和文件名的测试,使用许多伪文件来假装这个文件(波兰语语言环境),这一切都带来了结论,内容不是问题,只有.pl在文件名中会造成麻烦.
好问题是:
为什么Apache声称,这是脚本,虽然.pl(Perl?)部分文件名在中间,文件名实际上以.js或结尾.json?
为什么阿帕奇的Windows试图执行的Linux/Unix/Bash脚本,并正在寻找#!或'!在它的第一行字?
更好的问题是,如何解决这个问题,所以Apache会像所有其他语言环境文件一样将这个文件视为一个简单的Javascript?并不会尝试执行它?
在xampp\apache\conf\httpd.conf中,应该有一行如下:
AddHandler cgi-script .cgi .pl .asp
Run Code Online (Sandbox Code Playgroud)
只需注释掉这一行就像这样:
#AddHandler cgi-script .cgi .pl .asp
Run Code Online (Sandbox Code Playgroud)
并重启Apache.如果要保留.cgi和.asp处理程序,只需从行中删除.pl即可.即使你这样做,Perl实际上仍然可以工作.
| 归档时间: |
|
| 查看次数: |
4134 次 |
| 最近记录: |