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.
精彩评论