I found the following code in php.ini
. what does that mean?
And "PHP registers" -- what is that?
; This directive describes the order in which PHP registers GET, POST, Cookie, ; Environment and Built-in variables (G, P, C, E & S respectively, often ; referred to as EGPCS or GPC). Registration is done from left to right, newer ; values override older values. variables_order = "EGPCS"
EGPCS is the variable parsing order configured as the value of the variable_order directive in the PHP configuration file. It is used to configure the order of PHP superglobal variables $_ENV, $_GET, $_POST, $_COOKIE and $_SERVER. These global array elements are merged together and stored in the $_REQUEST array.
A variable starts with the $ sign, followed by the name of the variable. A variable name must start with a letter or the underscore character. A variable name cannot start with a number. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
The manual about the directive might help you a bit more : variables_order
(quoting) :
Sets the order of the EGPCS (Environment, Get, Post, Cookie, and Server) variable parsing. For example, if variables_order is set to "SP" then PHP will create the superglobals
$_SERVER
and$_POST
, but not create$_ENV
,$_GET
, and$_COOKIE
. Setting to "" means no superglobals will be set.
Also note (quoting again) :
The content and order of
$_REQUEST
is also affected by this directive.
I suppose this option was more important a while ago, when register_globals was still something used, as the same page states (quoting) :
If the deprecated
register_globals
directive is on (removed as of PHP 6.0.0), then variables_order also configures the order the ENV, GET, POST, COOKIE and SERVER variables are populated in global scope. So for example if variables_order is set to "EGPCS", register_globals is enabled, and both$_GET['action']
and$_POST['action']
are set, then$action
will contain the value of$_POST['action']
as P comes after G in our example directive value.
I don't see what I could add ; did this help ?
Or is this something in this that causes you a problem ?
The accepted answer above is good. But another important point to note here is that if any of these flags is not set, that variable will be empty when the script runs, i.e. if variables_order is set to "GPCS" the $_ENV variable will always be an empty array. Found this out the hard way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With