I need to get the name of the user executing a PHP script. Normally, get_current_user() does just that. However, the files that are being executed are in fact symlinked files which reside in another account and get_current_user() returns its name instead.
To illustrate:
(WRONG_USERNAME is the username of the account where the symlinked file physically resides).
The PHP script is being executed at:
/home/RIGHT_USERNAME/public_html/
get_current_user() returns:
WRONG_USERNAME
FILE returns:
/home/WRONG_USERNAME/public_html/file.php
But $_SERVER['DOCUMENT_ROOT'] returns:
/home/RIGHT_USERNAME/public_html
Is there a way to get just the RIGHT_USERNAME in my scenario? Of course, I could use the string returned by $_SERVER['DOCUMENT_ROOT'] and get rid of the "/home/" & "/public_html" parts but unfortunately, it's not the same on all servers.
Any ideas are welcome.
Thanks!
Tomas