Added an example on what register_globals means.

Defaults to off as of PHP 4.2.0 (links to release announcement)
Added a few links, like to predefined vars and superglobals
Cannot set at runtime, but may be able to use .htaccess
<note>: variables_order affects register_globals


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@87526 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2002-07-03 00:19:19 +00:00
parent d3d521db0c
commit 649707bdfd

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.57 $ -->
<!-- $Revision: 1.58 $ -->
<chapter id="configuration">
<title>Configuration</title>
@ -710,23 +710,37 @@ include_path=".;c:\www\phplib"
<listitem>
<para>
Tells whether or not to register the EGPCS (Environment, GET,
POST, Cookie, Server) variables as global variables. You may
want to turn this off if you don't want to clutter your
scripts' global scope with user data. This makes the most
sense when coupled with <link
linkend="ini.track-vars">track_vars</link> - in which case
you can access all of the EGPCS variables through the
<varname>$_ENV</varname>,
<varname>$_GET</varname>,
<varname>$_POST</varname>,
<varname>$_COOKIE</varname>, and
<varname>$_SERVER</varname>
arrays in the global scope.
POST, Cookie, Server) variables as global variables. For example;
if register_globals = on, the url
<literal>http://www.example.com/test.php?id=3</literal> will produce
<varname>$id</varname>. Or, <varname>$DOCUMENT_ROOT</varname> from
<varname>$_SERVER['DOCUMENT_ROOT']</varname>. You may want to turn
this off if you don't want to clutter your scripts' global scope with
user data. As of PHP <ulink url="&url.php.release4.2.0;">4.2.0</ulink>,
this directive defaults to <emphasis>off</emphasis>. It's preferred to
go through PHP <link linkend="reserved.variables">Predefined Variables
</link> instead, such as the
<link linkend="language.variables.superglobals">superglobals</link>:
<varname>$_ENV</varname>, <varname>$_GET</varname>,
<varname>$_POST</varname>, <varname>$_COOKIE</varname>, and
<varname>$_SERVER</varname>. Please read the security chapter on
<link linkend="security.registerglobals">Using register_globals</link>
for related information.
</para>
<para>
Please note that you need to set AllowOveride All in your
Directory block in the apache config file for this to work.
Please note that <systemitem role="directive">register_globals</systemitem>
cannot be set at runtime (<function>ini_set</function>). Although, you can
use <filename>.htaccess</filename> if your host allows it as described
above. An example <filename>.htaccess</filename> entry:
<userinput>php_flag register_globals on</userinput>.
</para>
<note>
<para>
<systemitem role="directive">register_globals</systemitem> is affected
by the <link linkend="ini.variables-order">variables_order</link>
directive.
</para>
</note>
</listitem>
</varlistentry>