admin管理员组文章数量:1410712
Setup: Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.7 with Suhosin-Patch configured
/etc/debian_version shows "squeeze/sid".
Copied a javascript ts_picker.js file to /usr/lib/cgi-bin (the configured CGI directory in apache conf files). All my PHP programs are in the same directory as well.
Tried running a simple PHP script which refers the ts_picker.js file within a <script src>
tag in the <HEAD>
.
But no javascript works. Apache error.log shows:
[Wed Apr 13 19:05:41 2011] [error] [client 10.0.0.37] (8)Exec format error: exec of '/usr/lib/cgi-bin/ts_picker.js' failed, referer: .php
[Wed Apr 13 19:05:41 2011] [error] [client 10.0.0.37] Premature end of script headers: ts_picker.js, referer: .php
Tried checking for permissions on the .js: they are 755, just as with all my PHP scripts.
Tried grepping 'javascript' and 'js' recursively under /etc/apache2 and found nothing except a DEFLATE entry:
/etc/apache2/mods-available/deflate.conf: # AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
/etc/apache2/mods-enabled/deflate.conf: # AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
Additionally, if I open the source of the PHP's HTML output on the browser and if I click on the ts_picker.js link there, it shows a 500 Internal error.
I am really stuck at this point and unable to do much. Any help is much appreciated. Thanks in advance.
Setup: Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.7 with Suhosin-Patch configured
/etc/debian_version shows "squeeze/sid".
Copied a javascript ts_picker.js file to /usr/lib/cgi-bin (the configured CGI directory in apache conf files). All my PHP programs are in the same directory as well.
Tried running a simple PHP script which refers the ts_picker.js file within a <script src>
tag in the <HEAD>
.
But no javascript works. Apache error.log shows:
[Wed Apr 13 19:05:41 2011] [error] [client 10.0.0.37] (8)Exec format error: exec of '/usr/lib/cgi-bin/ts_picker.js' failed, referer: http://10.0.27.200/cgi-bin/js.php
[Wed Apr 13 19:05:41 2011] [error] [client 10.0.0.37] Premature end of script headers: ts_picker.js, referer: http://10.0.27.200/cgi-bin/js.php
Tried checking for permissions on the .js: they are 755, just as with all my PHP scripts.
Tried grepping 'javascript' and 'js' recursively under /etc/apache2 and found nothing except a DEFLATE entry:
/etc/apache2/mods-available/deflate.conf: # AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
/etc/apache2/mods-enabled/deflate.conf: # AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
Additionally, if I open the source of the PHP's HTML output on the browser and if I click on the ts_picker.js link there, it shows a 500 Internal error.
I am really stuck at this point and unable to do much. Any help is much appreciated. Thanks in advance.
Share Improve this question edited Apr 13, 2011 at 14:47 Martijn 13.6k4 gold badges50 silver badges59 bronze badges asked Apr 13, 2011 at 14:13 KrishnaChaitanyaKrishnaChaitanya 111 gold badge1 silver badge2 bronze badges 1- 1 This belongs on serverfault.. This is a server configuration question, not a programming question. – Diodeus - James MacFarlane Commented Apr 13, 2011 at 14:29
1 Answer
Reset to default 3Javascript files are statically served assets - they are not executed by your webserver, but by the client browser. So they should not be set as executable, nor should they be in a scripts folder like /cgi-bin: as a result apache is trying to execute these js files when requested, as opposed to just serving them back. You need to move your js files to wherever static resources live, and set them to read-only.
本文标签: phpJavaScript not workingapache2UbuntuStack Overflow
版权声明:本文标题:php - JavaScript not working - apache2 + Ubuntu - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744784129a2624892.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论