zawmn83
zawmn83

Reputation: 809

Illegal Characters appended to javascript file

I think my apache webserver has got problem. I can't reference jquery.js

I get the following errors:

With chrome:

Uncaught SyntaxError: Unexpected token ILLEGAL

With firefox:

Error: illegal character
Source File: http://xxxxxxxxx/test/javascript/jquery.js
Line: 1
Source Code:
�Hz�ÚH[9�R

Below is my test html code

<html>
<head>
    <script type="text/javascript" src="javascript/jquery.js"></script>
    <script type="text/javascript">
        function doclick(){
            jQuery('#hello').attr('value', "mmmmef")
        }
    </script>
</head>
<body>
    <input type="button" name="hello" id="hello" value="hello" onclick="doclick();" />
</body>
</html>

It is not only happening to jquery.js, these illegal characters are being appended to all js and css files.

I login with ssh and view these js and css files with vi command, but there are none of these characters. But when I try to download or view/edit with FTP clients Filezilla or CuteFTP, these illegal characters are included.

What's wrong with my server? The same code can run in my local windows server and another centos server.

Upvotes: 8

Views: 5247

Answers (1)

zawmn83
zawmn83

Reputation: 809

I found the solution at

http://www.cyberciti.biz/tips/apache-223-corrupt-file-download-issue.html

Just open httpd.conf and put below lines

            EnableMMAP off
            EnableSendfile off

then

            # /sbin/service httpd restart

Upvotes: 18

Related Questions