Wordpress中未定义的变量Server-Can';不要发表评论


Undefined variable Server in Wordpress - Can't post comments

在我的Apache2日志中,我得到以下错误:

PHP Notice: Undefined variable: SERVER in /var/www/wp-comments-post.php on line 20

第20行:

$server_name = str_replace(".", "'.", $_SERVER["HTTP_HOST"]);

当我试图在博客上发表评论时,我会得到一个空白页面,URL变为mt domain.com/wp-comments-post.php,因此评论系统无法工作。

更新:我的wordpress在EC2上,位于弹性负载均衡器后面。我认为这就是没有设置变量的原因,因为它使用Alias。

我该如何解决这个问题。

使用Wordpress 3.5.2/Apache2/Ubuntu

谢谢。

检查php.ini中的variables_order指令,并确保S在字符串中。

它应该看起来像这样:

variables_order = "GPCS"