I use Apache's "mod_auth_form" module to authenticate users and it is working just fine. But now I need to figure out the user logged in to the web-site for some other application. I searched the web and found $_SERVER['REMOTE_USER']
variable in PHP. But I cannot get it to work. It does not return anything. Is there a way to get the REMOTE_USER
variable to work? Or is there another way to find the user logged in via Apache's auth_form module? My environment "Apache/2.4.6 (CentOS)" and "PHP 7.3.13".
Thank you.
EDIT:
I found the solution: To get the REMOTE_USER be populated, request must be made under a protected page. In short, I put the php file in private directory, and it worked. It would be nice to have it in all pages. However, I hope it helps someone else.