Entry
getting Apache environment variables from PHP
Feb 27th, 2003 13:52
Colin Foster, Javier Lasa, http://www.php.net/manual/en/configuration.directives.php#ini.register-globals
The problem with tracking down the answer here is that they seem to be
called "register globals" not "environment variables." :grumbles:
Anyway, edit the file:
/etc/httpd/httpd.conf
and at the end of this file add:
php_flag register_globals on
You can also edit the php.ini file and add
register_globals true
(I'm not sure what the correct format is for a php.ini file.)
-----
EDIT:
HOWEVER...
It seems there are some really good reasons for NOT turning
register_globals on:
http://www.php.net/release_4_1_0.php
As of 4.1.0 it's better to use these associative arrays:
* $_GET - contains form variables sent through GET
* $_POST - contains form variables sent through POST
* $_COOKIE - contains HTTP cookie variables
* $_SERVER - contains server variables (e.g., REMOTE_ADDR)
* $_ENV - contains the environment variables (e.g.,
$_ENV["REQUEST_URI"] )
* $_REQUEST - a merge of the GET variables, POST variables and
Cookie variables. In other words - all the information that is coming
from the user, and that from a security point of view, cannot be trusted.
* $_SESSION - contains HTTP variables registered by the session module
-Colin.