PHP 页面强制下载错误

发布于 2024-09-13 19:05:11 字数 653 浏览 5 评论 0原文

这是一个奇怪的问题,但它发生的次数足够多,我想问。

由于某些原因,有时浏览器会强制将 php 页面下载到浏览器,但它总是出现 0 字节。

请注意,我并不是试图强制下载,而且我非常熟悉标头并有意强制下载文件,我所说的是浏览器无法处理页面并因此吐出它的问题作为强制下载。

一个例子:我在 PHP4 服务器和 PHP5 云服务器上运行 phpMyAdmin 2.3.2。在 PHP5 云服务器上,如果我在表格上单击“浏览”,它会尝试吐出 sql.php 作为下载,但结果是空的。

我知道细节很模糊,我不希望有一个解决方案,而是希望找到一些想法,或者是否有其他人经历过同样的事情。

奇怪的更新:

当 URL 中包含全部大写的“Select”一词时,它就会中断。

作品: phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=选择

中断: phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=SELECT

面条那个!

This is a strange problem but it happens enough that I wanted to ask.

For some reason, sometimes the browser will force a php page to download to the browser and it always comes up with 0 bytes.

Mind you, I'm not trying to force the download and I'm very familiar with headers and forcing files to download intentionally, what I'm talking about is an issue where the browser can't process the page and thus it spits it out as a forced download.

One Example: I've got phpMyAdmin 2.3.2 running on a PHP4 server and a PHP5 cloud server. On the PHP5 cloud server, if I click "browse" on a table it tries to spit out sql.php as a download and it comes out empty.

I know the details are vague and I don't expect a solution as much as some ideas in where to look or possibly if someone else has experienced the same thing.

BIZARRE UPDATE:

When the URL has the word "Select" in all caps it breaks.

Works:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=Select

Breaks:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=SELECT

Noodle that one!

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

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

发布评论

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

评论(3

深者入戏 2024-09-20 19:05:11

答案:

事实证明,SELECT、UPDATE 和 INSERT(是的,全部大写)这些词在 RackSpace 云上被屏蔽。您不能通过 GET 请求传递这些内容,只能通过 POST 传递。

但是,如果将它们更改为“选择”、“更新”和“插入”,它们就可以正常工作。看来他们并没有阻止一切。

ANSWER:

As it turns out, the words SELECT, UPDATE and INSERT (yes, all caps) are blocked words on The RackSpace cloud. You cannot pass these via a GET request, only POST.

However, if you change them to Select, Update and Insert they work just fine. Seems they are not blocking everything.

总以为 2024-09-20 19:05:11

我发现当我尝试访问没有有效网络路由的服务器时。例如,我在 Firefox 中通过 ssh 设置隧道代理。然后尝试连接到本地主机 - 我下载了一个 0 字节的 PHP 文件。

正在进行下载是因为它有 PHP 扩展,没有内容,并且服务器没有向您发送 MIME 类型,因此浏览器不知道如何处理它,并恢复下载。

听起来像是服务器配置错误。

附言。停止使用 PHP 4。

I have seen that when I'm trying to access a server to which I don't have a valid network route. For example, I set a tunnel proxy in Firefox, through ssh. Then try to connect to localhost - I get a download of a 0 byte PHP file.

The download is happening because it has an extension of PHP, with no content, and the server is not sending you a MIME type, so the browser doesn't know how to handle it, and reverts to a download.

Sounds like a server misconfiguration.

PS. stop using PHP 4.

坏尐絯℡ 2024-09-20 19:05:11

根据我的经验,这有时会导致网络服务器的分段错误,因为 php 脚本表现不佳(foo(){foo();} 类型的崩溃),

分段错误会记录在 apache 错误中日志。

In my experience this sometimes comes with a segmentation fault of the webserver, due to php scripts behaving badly (the foo(){foo();} kind of crash)

segmentations faults are logged in the apache error log.

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