I have an Ubuntu server with a LAMP stack. I have some javascript that has a php include in the middle of it.
For the past year the code has worked fine, but now there is a strange set of characters appearing at the end when viewed in a browser:
‹
It seems to be connected to the .js.php file extension. I can simplify it down to:
- create test.php
- create test.xx.php
- create test.js.php
- edit the files with vi and put in the word
test - view them in a web browser
- http://example.com/test.php will display
test - http://example.com/test.xx.php will display
test - http://example.com/test.js.php will display
test ‹
In notepad++ it show that there are a couple of extra characters that are actually there:

Its not a standard PHP openend bracket < which might make sense.
Hunting for ‘.js.php’ or the characters in Google is pretty fruitless, so I’m completely stuck.
I had this problem too. The problem seems to be caused by the server gzipping the response incorrectly. (With mod_deflate of course).
Disabling mod_deflate through .htaccess resolved the issue for me – note that you can do something like this to disable per filetype:
Strangely, I have two supposedly identical Ubuntu VMs – one where everything runs perfectly, and one where I need to disable mod_deflate. If anyone can figure why this is happening, I’d be interested to know!