Drupal或者Joomla等系统都要求运行的PHP环境关闭了register_globals,而有一些主机在默认的情况下 register_globals是开启的,像HostGator就是这样,这里如果我们安装Drupal等就会因为严重错误而停止安装,并要求你关闭主 机的register_globals,如下面的就是在安装Drupal时因为register_globals开启而出现的警告:
register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings. (Currently using PHP register globals Enabled (’1′))
这 里,我们应该怎么办呢?当然,因为register_globals开启而出现的重大错误肯定要以关闭register_globals的方式来解决,但 并不是每一个人都是使用自己的服务器能对PHP进行详细的设置,这时我们只有使用其它的方法了,下面是我使用过的三个方法,希望对正遇到这样问题的人有所 帮助。
$register_globals = trim(ini_get('register_globals')); // Unfortunately, ini_get() may return many different values, and we can't // be certain which values mean 'on', so we instead check for 'not off' // since we never want to tell the user that their site is secure // (register_globals off), when it is in fact on. We can only guarantee // register_globals is off if the value returned is 'off', '', or 0. if (!empty($register_globals) && strtolower($register_globals) != 'off') { $requirements['php_register_globals']['description'] = $t('<em>register_globals</em> is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when <em>register_globals</em> is enabled. The PHP manual has instructions for <a href="http://php.net/configuration.changes">how to change configuration settings</a>.'); $requirements['php_register_globals']['severity'] = REQUIREMENT_ERROR; $requirements['php_register_globals']['value'] = $t("Enabled ('@value')", array('@value' => $register_globals)); } else { $requirements['php_register_globals']['value'] = $t('Disabled'); } |
你可以做本文的第一个留言者!
这里还没有留言,你可以做第一个留言者