第一次访问页面时,Drupal 生成的 HTML 上方出现神秘数字

发布于 2024-10-02 06:07:06 字数 1593 浏览 0 评论 0原文

在我的 Drupal 站点上的许多页面上,第一次在(编辑)任何浏览器中访问该页面时,HTML 上方(编辑:和下方)会出现一个神秘的数字。在 IE7 和 IE8 中,问题页面渲染不正确,但在其他浏览器中,页面的其余部分渲染没有问题。刷新后,该数字通常会消失。我的用户告诉我,该错误每天早上都会再次发生,尽管我见过用户刷新并且奇怪的数字不会消失的情况。我使用其他浏览器没有遇到任何问题。

以下是 HTML 的前几行:

3535 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

.. 页面的其余部分正常生成,然后我在底部看到以下内容:

</html> 

0 

我很困惑 - apache 日志或我的虚拟主机 error.log 上没有出现任何相关内容。我已经对带有数字的页面和没有数字的页面上的 html 进行了比较,除了顶部和底部的数字之外,唯一的区别是空格。

我在 Ubuntu 7.04 上的 Apache 2.2 中运行 Drupal 6.19。 PHP 版本是 5.2。

作为参考,这里是我的 index.php - 我认为我们没有对标准进行任何更改。

<?php
// $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $

/**
 * (Drupal copyright ommitted for brevity)
 */

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}

drupal_page_footer();

On a number of pages on my Drupal site a mysterious number appears above (EDIT: and below) the HTML the first time the page is visited in (EDIT) any browser. In IE7 and IE8 the problem pages are rendering incorrectly, but in the other browsers the rest of the page renders without problems. After a refresh the number usually disappears. My users tell me that the error occurs again each morning, although I've seen one case where a user refreshes and the strange number does NOT go away. I've had no problems with other browsers.

Here are the first few lines of HTML:

3535 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

.. the rest of the page generates normally, and then I see the following at the bottom:

</html> 

0 

I'm baffled - nothing related appears on either apache logs or my vhost error.log. I've done a diff of the html on pages with the number versus pages without and apart from the numbers at top and bottom the only difference is whitespace.

I'm running Drupal 6.19 in Apache 2.2 on Ubuntu 7.04. PHP version is 5.2.

For reference here's my index.php - I don't think there's anything that we've changed from the standard.

<?php
// $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $

/**
 * (Drupal copyright ommitted for brevity)
 */

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}

drupal_page_footer();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

只等公子 2024-10-09 06:07:06

在花费大量时间检查自己的代码之前,请分析所涉及的网络设置。

大约一年前,我们遇到了类似的现象,代理服务器将类似的数字插入到他转发的页面中。

我不记得它是什么代理服务器以及他为什么这样做的详细信息,但这非常明显,因为只有从某些网络访问该网站的人才会获得这些数字。

编辑:我不是100%确定,但我认为这是这个nginx反向代理问题这篇文章也可能相关。)

Before spending much time checking your own code, analyze the involved network setup.

We had a similar phenomenon about a year ago where a proxy server inserted numbers like that into the pages he relayed.

I do not remember the details about what proxy server it was, and why he did it, but it was pretty obvious, as only people accessing the site from certain networks would get these numbers.

EDIT: I'm not 100% sure, but I think it was this nginx reverse proxy issue (This post might be related as well.)

煮茶煮酒煮时光 2024-10-09 06:07:06

所有浏览器的标记很可能都是相同的,但只有 IE 会呈现它。

我最好的猜测是,某个地方有一段调试代码正在打印一些 id。如果您有自己开发的任何模块/主题,那将是最好的起点。

如果找不到来源,可以尝试切换主题并关闭模块,最终应该能够找到它。首先尝试在代码中搜索 print_r 语句。

Most likely the markup is the same for all browsers but only IE renders it.

My best guess is that somewhere there is a snip of debugging code that is printing out some id. If you have any modules/theme you have developed yourself that would be the best place to start.

If you can't find the source, you can try to switch theme and turn off modules, you should be able to pinpoint it eventually. At first try searching your code for a print_r statement.

把梦留给海 2024-10-09 06:07:06

假设您使用反向代理来访问 Apache,请将以下行添加到全局配置(例如 apache2.conf):

SetEnv force-response-1.0 1
SetEnv downgrade-1.0 1

对于我的 Ubuntu/Debian 安装(使用 nginx 作为反向代理) ),我将这些行放入 /etc/apache2/conf.d/force-http-1.0.conf

Presuming that you're using the reverse proxy for all access to Apache, add the following lines to the global configuration (e.g. apache2.conf):

SetEnv force-response-1.0 1
SetEnv downgrade-1.0 1

For my Ubuntu/Debian installation (with nginx as the reverse proxy), I put these lines into /etc/apache2/conf.d/force-http-1.0.conf

樱花落人离去 2024-10-09 06:07:06

我不知道是否是同样的问题,但是有一天早上,所有可能的 drupal 页面上都出现了一个奇怪的代码,显示在最底部,我不明白,无论如何,这是我在前一天晚上创建的一个页面,目的地是反馈表,我删除了它,一切都恢复正常,无论如何,有时这种情况发生是因为捕获器超载,只需做 phpmyadmin 并清除捕获器,我希望这会有所帮助,se ya!

i don´t know if is the same problem, but one morning on all may drupal pages was a strange code showin at the very buttom, i wasn´t understanding, any way it was a page that i created a night before destinated to a feedbackform, i deleted that and all back to normal, any way some times this things happends because of a overloading of the catche, just ho do phpmyadmin and clear the catche, i hpe this helps, se ya!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文