开发者

how can I use the exec function in PHP on a specific user

By default when system() and exec() functions are used in PHP the default user is SYSTEM so I can never see the result. Is there a way to cha开发者_StackOverflownge the user it runs on?


To addon to webbiedave, you can output or save it to a file. My recommendation would be to save it to a database if you can, this will prevent a race condition.


The web server may have provisions for running scripts as another user (e.g. suEXEC), but PHP itself cannot do so.


You can define a cronjob (specific user), that checks a file every minute. With PHP (other user) you can write to this file. If the cronjob find something in the file, it starts processing the task under a specific user. That's is the only way IMHO to change the user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜