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.