I have a PHP script on Linux in which the sticky bit is set, so it gets executed as the file owner. How can I get the user id of the calling process, for authorization purposes?
Context: I have two applications on a server, and want one to request some info from the other. For this reason the other offers a script with setuid, but I want to make sure it can only be called by the one.