简体   繁体   English

仅加载页面的一半

[英]Only half of page loading

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. 我有一个直到最近都可以正常运行的应用程序(CakePHP 2.2),但是突然之间,它只开始提供部分页面。 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). 该页面的HTML被截断了,但是它并不总是每次都在完全相同的位置截断(尽管它在同一位置)。

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. 这次,我尝试重新启动Apache,而不是整个服务器,这似乎并没有解决问题。

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. 更新 :我现在也尝试禁用APC,但是禁用此问题后问题仍然存在。

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… 如果我在CakeResponse :: __ setContentLength()中取消设置Content-Length标头,则整页显示正常,这是返回的标头…

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… 如果我未设置Content-Length标头,则显示的页面将被截断,并且响应标头是…

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... 我认为这是报头长度的计算,除了以下事实:在我的本地计算机上,即使未设置Content-Length报头,即使返回的Content-Length与生产服务器上的相同,也会显示整个页面。 。

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. 该脚本必须die ,然后在死代码显示后停止HTML。

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. 您需要进一步研究CakePHP的代码,并检查逻辑函数没有意外结束,并且没有未完成的die函数可能导致HTML加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM