Hello,
Is it possible to add a new key-value pair to the $_SERVER superglobal array?
For example, when portions of facebook's code was leaked, there were many include clauses containing $_SERVER['PHP_ROOT']. I am guessing that $_SERVER['PHP_ROOT'] is storing the path to where all of the source code is kept, a path which is not accessible to an outsider.
I want to do the same, but I haven't found any resources that explain how this is done. Is modifying the $_SERVER array done by changing the configuration on the server app, such as appache?
Or perhaps there is a better approach to storing the path to a directory outside of the public one?
THanks
adding a new key,value pair to the $_SERVER global array
Moderator: General Moderators
-
mechamecha
- Forum Commoner
- Posts: 32
- Joined: Thu May 31, 2007 8:49 pm
-
jeffery
- Forum Contributor
- Posts: 105
- Joined: Mon Apr 03, 2006 3:13 am
- Location: Melbourne, Australia
- Contact:
If you have Apache module mod_env (environment) turned on, in an .htaccess file you can do this:
Code: Select all
SetEnv PHP_ROOT "/usr/share/application/"- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
The following works.
Code: Select all
$_SERVER['floob'] = 'party time';