I have an application (CakePHP 2.2) that worked fine up until lately, however all of a sudden it's started only delivering part of the page. The HTML for the page is truncated, however it doesn't always truncate at exactly the same place each time (although it's about the same place).
I've had someone else test this from another location & they also experienced the same problem.
The first time I had this problem I restarted the server & it appeared to resolve the problem, however it's happened again. This time I've tried restarting Apache, rather than the whole server & it does not appear to have resolved the problem.
I'm not sure what else to try, so any suggestions welcome.
Thanks in advance.
Update: I've also now tried disabling APC but the problem continued after this was disabled.
Another update: Having tried adding content above & below the point it was truncating, it would appear that it is truncating at a certain distance from the end of the file, as the approximate break point only moved when content is added after where it's breaking.
Yet another update... OK, so I've done even more digging & there seems to be a problem with the calculation of the content length on my production server. Here's the output from my digging (Date headers stripped to save space)...
Server with Content-Length unset
If I unset the Content-Length
header in the CakeResponse::_setContentLength(), the full page displays fine, & this is the header returned…
Connection close
Server Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.0-fips mod_bwlimited/1.4
Transfer-Encoding chunked
X-Powered-By PHP/5.3.24
Server with Content-Length set
If I don't unset the Content-Length
header then the page displayed is truncated, & the response headers are…
Connection close
Content-Length 2455
Content-Type text/html; charset=UTF-8
Server Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.0-fips mod_bwlimited/1.4
X-Powered-By PHP/5.3.24
Local Machine with Standard Content-Length
I would think it's the header length calculation, apart from the fact that on my local machine, even without unsetting the Content-Length
header, the full page displays, even though the Content-Length
returned is the same as on the production server...
Connection Keep-Alive
Content-Length 2455
Content-Type text/html; charset=UTF-8
Keep-Alive timeout=5, max=100
Server Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.8x
X-Powered-By PHP/5.3.15
From what I can gather,
the script must be
die
'ing and then stopping the HTML after the die code from displaying.You need to look further into the code of CakePHP, and check that the logical functions are not ending unexpectedly and that there is no outstanding die function that could cause the HTML from loading.