I did come across a description of how to get a value into the log file from PHP, however this effectively works by setting an arbitrary environment variable and substituting that in the log config string.
Really I want to control the value referenced by %u in the log config string along the way. The only way this seems to be possible is for the value to be returned by an auth module in Apache.
There's no end of mod_auth modules to choose from - however most seem to implement their own session management (i.e. generate their own cookies and maintain their own username-session lookups).
In an ideal world, I would want a module which:
- would allow me to specify the session cookie name
- could retrieve an arbitrarily/configurable named variable from a PHP session containing the username
- would then cache non-null sessionid/username combinations
- where appropriate, would redirect users to a configurable login URL
I used to be passable at C programming - so I could write my own if necessary - unfortunately a lot of the links from https://modules.apache.org are dead (mod_auth_any, mod_auth_cookie_dbm) so I'm having trouble finding something close to what I need to understand the API / finding something which I could use out of the box.
Any suggestions of well written modules which might provide what I need, or which are close to my requirements and well written/maintained?
TIA
C.