在AWS上执行PHP脚本后不需要的换行符(LF)

I've a simple PHP script called from an AJAX function. To check if the script was successful i'm doing something like this:

$http({
      url: '/xxxx.php',
      method: "GET",
      params: {yyy: zzz}
    })
    .success(function(data) {
      if (data!="") { // if success
             ...........

The problem is that on my local server all works fine, but when I upload the scripts to my AWS servers, the execution of PHP scripts always add a LF (newline or ) at the end of the file, and all my JS scripts fail because the data string is not empty.

I've checked the data string and data has a LF (ASCII code 10) at first position, so the JS 'if check' (data!="") always fails.

Anyone knows why the PHP script adds a LF at the end on AWS, but the same script works fine on my local stack? I don't wanna change all my conditional JS checks, so I like to remove the LF attached at the end of the PHP output, but changing the ¿PHP/APACHE/SERVER? configuration itself, not modifiying the script files.

Thanks in advance!