I’m doing some custom authentication written in PHP and need to set the REMOTE_USER variable, and make it stick, for use in other applications on the web server.
I’m able to set the REMOTE_USER variable and display it in $_SERVER, and used apache_setenv(), but a phpinfo() call in a second page doesn’t list the variable as being set.
The web server is Apache 2 with PHP 5. Any thoughts?
Addendum: An example situation would be I authenticate a user against a database table and set the REMOTE_USER variable for them and then send them via proxy to a second server, passing REMOTE_USER along the proxy, as described here for one system:
http://docs.splunk.com/Documentation/Splunk/4.3.1/Admin/Usesinglesign-onwithSplunk
Don’t use
$_SERVER. That variable is populated from the server hosting PHP, and isn’t something you should be messing with.What you’re looking for is
$_SESSION.http://php.net/manual/en/features.sessions.php