如何检查什么用户PHP是运行的? [英] How to check what user php is running as?

查看:118
本文介绍了如何检查什么用户PHP是运行的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要如果PHP运行作为无人察觉。我该怎么做呢?

I need to detect if php is running as nobody. How do I do this?

是否有任何其他的名字,没有人? 阿帕奇?任何其他方面?

Are there any other names for "nobody"? "apache"? Any others?

推荐答案

如果您使用可以使用 posix_geteuid探测当前的用户帐户 ,然后用得到的用户名 posix_getpwuid

If available you can probe the current user account with posix_geteuid and then get the user name with posix_getpwuid.

如果您在但是安全模式(这往往是当EXEC被禁用的情况下)上运行,那么可能你的PHP进程下的任何运行,但默认的 www数据阿帕奇帐户。

If you are running in safe mode however (which is often the case when exec is disabled), then it's unlikely that your PHP process is running under anything but the default www-data or apache account.

这篇关于如何检查什么用户PHP是运行的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆