PHP 页面中途停止加载,使用 ODBC、数据源、MSSQL

发布于 2024-10-30 18:27:20 字数 698 浏览 4 评论 0原文

我们有一个大部分是静态的页面,其中包含一些 PHP 包含内容,每个包含内容都从我们的 MSSQL 数据库中提取数据。

有一个非常奇怪的问题,页面会随机停止渲染。该问题是偶发的,并且并不总是可见。有时页面会正确加载,有时会在到达文件末尾之前停止。

您可以在其中看到问题的相关页面位于 开发人员:http://author.www.purdue.edu/discoverypark/climate/ 产品:http://www.purdue.edu/discoverypark/climate/index.php

如果您反复刷新页面,您将有望看到该问题。该问题仅存在于包含对数据库的调用的页面上,但大多数情况下页面加载完全正常;只是有时它会停止输出页面。它破坏了正常 html 内部以及 php 块之前和内部。

在生产环境中这个问题似乎更严重;两者之间的唯一区别是数据源与数据库的连接。

PHP、ODBC 和 MSSQL 是否存在任何已知问题?它显然与对数据库的调用有关,这些调用都是存储过程。会不会是数据源的问题?

任何意见将不胜感激。

We have a page that is mostly static with a few PHP includes, each of which pull data from our MSSQL database.

There is a very strange issue where pages will randomly stop rendering. The problem is sporadic and not always visible. Sometimes the pages load correctly, sometimes they stop before reaching the end of the file.

The page in question where you can see the problem is at
Dev: http://author.www.purdue.edu/discoverypark/climate/
Prod: http://www.purdue.edu/discoverypark/climate/index.php

If you refresh the page repeatedly you will hopefully be able to see the issue. The problem only exists on pages that include calls to our database, but again the pages load completely normally most of the time; only sometimes it will stop outputting the page. It has broken inside of normal html as well as before and inside php blocks.

The issue seems to almost be worse in the production environment; the only difference between the two would be the datasource connection to the DB.

Are there any known issues of this with PHP, ODBC, and MSSQL? It is obviously tied to the calls to the database, which are all stored procedures. Could it be an issue with the datasource?

Any input would be appreciated.

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

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

发布评论

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

评论(4

揪着可爱 2024-11-06 18:27:20

当它消失时,我总是在“查看源代码”中看到这一点:

我猜你的图像缓存或图像 URL 生成或图像处理可能在某个地方被破坏,并且由于缺少图像而中止。

> INSIDE 的 alt 值也不合规矩需要使用 http://php.net/htmlentities 进行转义,

它可能“有效”,但不会。 t 验证,并且不验证的页面只是简单地损坏,

例如,DEV 中的本地主机和 PROD 中的单独框之间的数据库连接差异可能会改变问题的时间/频率,但几乎可以肯定是红色。鲱鱼...

虽然如果查找 OVPR 映像的数据库调用正在执行 die()...

但是,可以肯定的是,如果在每次调用 odbc_* 或 mssq_* 时没有 10 行错误处理你的数据库代码,那么你做错了,需要添加

PS 。
如果上述方法均不起作用,那么从 ODBC 切换到 mssql_* 或 sybase_* 驱动程序或 PDO::* 应该很简单,并消除至少一个可能的竞争者。不过,我再说一遍,数据库 99% 肯定是转移注意力的,一旦你追踪到真正的原因,你就做了一些显而易见的事情,我敢说很愚蠢……

I consistently see this in "View Source" when it dies:

<div class="wrap">
<a href="/research/vpr/">OVPR</a>
<img alt=">" src=".

I would guess that your image caching or image URL generating or image handling is probably broken somewhere, and it's aborting for lack of an image.

The > INSIDE the alt value is also not kosher. That needs to be escaped with http://php.net/htmlentities

It might "work" but it won't validate, and a page that doesn't validate is just plain broken.

The DB connection differences between, say, localhost in DEV and separate boxes in PROD is probably changing the timing / frequency of the issue, but is almost for sure a red herring...

Though if a DB call to look up the OVPR image is doing a die()...

For sure, though, if you don't have 10 lines of error handling around every call to odbc_* or mssq_* in your database code, then you've done it wrong, and need to add that.

PS
It should be trivial to switch from ODBC to mssql_* or sybase_* driver, or PDO::* and eliminate at least one possible contender, if none of the above work out. I say again, though, that the DB is 99% for sure a red herring, and you've done something that will be obvious, dare I say silly, once you trace it through to the real cause...

一枫情书 2024-11-06 18:27:20

确保代码中任何地方都没有骰子或退出

编辑 - 如果有,请将其删除,然后查看错误

Make sure there isn't a die or exit in the code anywhere

Edit -- If there is, remove this, and view the error

请帮我爱他 2024-11-06 18:27:20

你检查过正常的调试方法吗?代码是什么样的 - 具体来说,围绕 ODBC 调用的错误处理?你没有顶级回报或放错地方的 die(),是吗?

当我看到该页面处于非渲染状态时,似乎是因为该页面显然不完整并且它是 XHTML。

我看到它通常死在这里 -

<a href="/research/vpr/">OVPR</a>

Have you checked normal debugging methods? What does the code look like - specifically, the error handling around your ODBC calls? You don't have a top level return or a misplaced die(), do you?

When I see the page in it's not-rendering state it seems to be because the page is clearly incomplete and it's XHTML.

I see it normally die here -

<a href="/research/vpr/">OVPR</a>
一个人的旅程 2024-11-06 18:27:20

尝试提高错误报告级别,以便您可以看到可能在服务器级别抑制的任何警告、错误和信息。

http://php.net/manual/en/function.error-reporting.php

// Report all PHP errors
<?php error_reporting(-1); ?>

Try bumping up your error reporting level so that you can see any warnings, errors, infos that might be suppressed at the server level.

http://php.net/manual/en/function.error-reporting.php

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