我的网站完全空白,有诊断提示吗?
我有一个基于 OpenCart(我相信是 1.5.0)构建的电子商务网站,在插入来自 Alexa.com 的跟踪代码和用于重定向到另一个网站的代码块后,该网站完全空白。最初它有效,所以我觉得保存备份是安全的。但刷新页面后它是空白的,并且我所有浏览器(firefox、chrome、safari)中的“查看源代码”选项显示没有代码到达它们。然后我开始遵循一系列调试步骤:
- 由于我的文本编辑器仍然打开,我撤消了所有更改并重新上传,没有任何更改。
- 我扫描了文档以确保文本中没有问题,没有发现任何问题,
- 我通过 W3C 运行它验证,有 2 个警告,1- 无字符编码,2- 无法确定解析模式。
- 联系主机进行服务器端恢复,尽管他们最早的备份是问题开始后的一天(花了 3 天的时间争论才让他们启动恢复)
关于这些验证警告,我不确定应该使用什么编码OpenCart、ASCII 或 UTF-8(验证器使用的)或其他什么,此外,我不确定如果我要声明编码,OpenCart 使用的模板是否会与其冲突。此外,我发现很难相信如此广泛分布的产品会有如此简单的事情导致如此巨大的错误,因为所有用户都会遇到这个问题。
关于解析模式,索引页确实声明了解析模式(在包含的头文件中)。
除此之外,验证器还声称它根本没有接收到代码,这使得通过该路径确定问题的任何机会都消失了。
页眉和页脚都针对这些添加内容进行了编辑,但包含在其中的时间相对较长。用于编辑的代码是,对于 alexa 插入到头文件的 head 部分,页脚的代码是:
<span style="display:inline-block;width:160px;height:30px;text-align:center;border:#000 1px dotted;font-family:Arial,Helvetica,sans-serif;font-size:11px;background-color:#FFFFFF;"><strong style="display:block;padding:0px;margin:0px;">Reputation Management</strong><a href="http://www.submitexpress.com/" title="Submit Express - Search Engine Optimization Services" style="font-family:Arial,Helvetica,sans-serif;font-size:11px;">Submit Express</a></span>
如果还有代码是如果需要帮助,请告诉我,我不是在找人来解决我的问题,而是给我相关的提示来帮助我自己解决问题,或者他们是否确实提供了解决方案来教育我如何管理它,这样我就可以可以使用同样的调试方法。谢谢!
编辑:感谢 Jay 发现的问题是“PHP 通知:未定义索引:HTTP_HOST in **/public_html/graphic-shack.com/index.php第 40 行”,谷歌搜索没有显示任何有效结果。对于我未经训练的头脑来说,这是胡言乱语,非常感谢澄清,因为第 40 行实际上是一个空行,由于其周围的文本由于某种原因我无法发布,但可以在 http://graphic-shack.com/example.html
I have an ecommerce site built on OpenCart (1.5.0 i believe), which after inserting tracking code from Alexa.com and a block of code for redirecting to another site went entirely blank. Initially it worked, so I felt it was safe to save over my backups. But after refreshing the pages it was blank, and the 'view source' option in all my browsers (firefox, chrome, safari) revealed that there was no code reaching them. I then began to follow a series of debugging steps:
- As my text editor was still open I undid all changes and reuploaded with no changes
- I scanned the documents to be sure there were no issues in the text, with no discoveries
- I ran it through W3C validation, with 2 warnings which are 1- no character encoding and 2- unable to determine parse mode.
- contacted host for a server side restore though their earliest backup was a day after the problem began (it took 3 days of arguing to get them to initiate a restore)
In regards to these validation warnings, I am not sure what encoding should be used for OpenCart, ASCII or UTF-8 (which the validator resorted to) or what, in addition I am not sure if the template used with OpenCart would conflict with it if I were to declare encoding. In addition, I find it hard to believe that such a widely distributed product would have something this simple causing such a huge mistake because then all users would have this issue.
In regards to parse mode, the index page does declare parse mode (in the included header file).
In addition to all this, the validator is also claiming that it is not receiving code at all, which disables any chance of determining problems through that route.
The header and footer were both edited for these additions but are relatively long to include in this. The code used to edit were, for alexa <!-- tracking code here -->
inserted into the head section of the header file, and the code for the footer was:
<span style="display:inline-block;width:160px;height:30px;text-align:center;border:#000 1px dotted;font-family:Arial,Helvetica,sans-serif;font-size:11px;background-color:#FFFFFF;"><strong style="display:block;padding:0px;margin:0px;">Reputation Management</strong><a href="http://www.submitexpress.com/" title="Submit Express - Search Engine Optimization Services" style="font-family:Arial,Helvetica,sans-serif;font-size:11px;">Submit Express</a></span>
If anymore code is needed to help then please let me know, I am not looking for someone to fix my problem but to give me relevant tips to help figure it out myself or if they do provide a fix to educate me as how they managed it so I may be able to use the same debugging method. Thanks!
EDIT: The issue, as discovered thanks to Jay, is "PHP Notice: Undefined index: HTTP_HOST in **/public_html/graphic-shack.com/index.php on line 40" and a google search has not revealed any effective results. This, to my untrained mind is jibberish, clarification would be greatly appreciated as line 40 is in fact a blank line, where as the text around it I can not post for some reason but will be viewable at http://graphic-shack.com/example.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Open Cart 始终使用 UTF-8,因此绝对最好使用您的主题应为浏览器设置的内容
我要问的第一件事是你是否设置了记录 php 错误的错误报告(不是打开的购物车)?
如果没有,那么您需要
在 .htaccess 文件中执行类似的操作,以便可以将所有 php 错误记录到文件中。这需要位于您可以获取该文件的位置,因此请相应地更改路径,以便您可以查看它。
一旦掌握了这一点,您将为解决问题奠定良好的基础。我很难相信 opencart 已经停止了,因为你添加了代码。最可能的原因是文件丢失、空白或在保存时意外写入一半,或者您在不应该的地方有一些额外的 php 代码
== TEST.PHP CONTENT ==
Open Cart uses UTF-8 throughout, so its definitely best to use that which your theme should set for the browser in the
The first thing I would ask is have you got error reporting set up (NOT OPEN CARTS ONE) that logs php errors?
If not, then you need to do something like
in your .htaccess file, so that you can log all your php errors to a file. this will need to be somewhere you can get the file, so change the path accordingly so you can view it.
Once you have that, you'll have a good base for working out the problem. I find it hard to believe that opencart has stopped because you added code. The most likely cause is a file missing, blanked or half written accidentally when saving or you've got some extra php code somewhere you shouldn't
== TEST.PHP CONTENT ==