【问题标题】:Can't access cpanel, getting "HTTP ERROR 500"无法访问 cpanel,出现“HTTP ERROR 500”
【发布时间】:2016-06-09 14:24:28
【问题描述】:

由于某种原因,我无法再访问我的 HostPapa cpanel,它说:

The www.hostpapa.ca page isn’t working
www.hostpapa.ca is currently unable to handle this request.
HTTP ERROR 500

我检查了我的错误日志,发现在不同的日期/时间重复出现同样的错误:

[07-Jun-2016 14:30:26 America/Toronto] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/saltn168/public_html/tripepic.com/tripepic-theme/List/tripepic-theme.php on line 1160
[07-Jun-2016 19:26:50 America/Toronto] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/saltn168/public_html/tripepic.com/tripepic-theme/List/tripepic-theme.php on line 1160
[08-Jun-2016 08:45:14 America/Toronto] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/saltn168/public_html/tripepic.com/tripepic-theme/List/tripepic-theme.php on line 1160
[08-Jun-2016 20:35:00 America/Toronto] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/saltn168/public_html/tripepic.com/tripepic-theme/List/tripepic-theme.php on line 1160
[08-Jun-2016 23:14:13 America/Toronto] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/saltn168/public_html/tripepic.com/tripepic-theme/List/tripepic-theme.php on line 1160

我检查了那个文件,第 1160 行是:

if(isset($r[2]) && @$r[2] == 'img' && preg_match('/MSIE [5-7]/',$_SERVER['HTTP_USER_AGENT']) == 0) {

对我来说这看起来像是胡言乱语,所以我不知道该怎么做。昨天我的搭档让我成为该网站的“超级管理员”——不确定它是否与此有关?或者为什么会是平的。

如果有人能指出正确的方向,我将不胜感激。

谢谢

【问题讨论】:

  • 你用的是什么浏览器?
  • 您可以在preg_match 之前添加条件&& isset($_SERVER['HTTP_USER_AGENT'])
  • 我正在使用 Chrome,但我只是在 Safari 中尝试过,它可以工作。太奇怪了。
  • @AngelaMartinez 就像我上面贴的问题说的那样,User-Agent header 是可选的,所以如果设置了就不会出错,如果没有设置就会出错,因为您将尝试访问不存在的索引。所以最好检查一下是否设置了isset()

标签: php regex error-handling phpmyadmin server


【解决方案1】:

用户代理标头是一个可选标头。某些东西可能会对其进行过滤(例如防火墙),或者人们可以将其客户端配置为省略标头。

您可能想用isset() 检查标头是否存在。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-15
    相关资源
    最近更新 更多