[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

How can I set an Apache server variable from PHP?

Asked by field-effect in Apache Web Server, PHP Scripting Language, Web Servers

Tags: php, apache, server variable, authentication

I have a PHP based site (on Apache on Linux) which already uses its own authentication (with a local MySQL database), and I have to integrate with a new web service further back in my infrastructure. I can proxy the traffic through my web server to the remote web server, and they are going to authenticate based on a server variable being set (for the sake of example, let's say it's AUTH_USER).

I could use an apache module to do the authentication, but I really don't want the user-unfriendly popup asking for login credentials, and many aspects of my site don't require a login. What i really need to do is get my PHP to set the Apache AUTH_USER server variable, so when it is passed through to the other web server, they will see it.

I know that this isn't easily possible, and that if I set anything in the $_SERVER superglobal it doesn't survive or get back to Apache in a lasting way. Is there any indirect way that i can do something from PHP that will cause a server variable to be set by Apache. Maybe I could set a session variable and then have an Apache module that somehow reads the session variable and sets a server variable? I have complete control of my server, so i can implement pretty much anything that needs to be done.

 
Loading Advertisement...
 
[+][-]04/04/09 10:44 PM, ID: 24070293Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625