How do I find out, which user is running the current php script?

前端 未结 5 1025
生来不讨喜
生来不讨喜 2021-01-11 14:21

How do we determine which user the php script is running under when I run the script on server? Is it running under the same user as apache or phpmyadmin by chance? My quest

5条回答
  •  [愿得一人]
    2021-01-11 14:50

    Do not use "whoami". When you execute a process the user will not necessarily be the same as the effective user during running of a script. But in any case "id" would provide much more useful information. Instead call get_current_user(). So simple!

提交回复
热议问题