On 7/26/07, Michael B Allen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How does one determine if a command line PHP script is being executed as root?
>
> If there's no posix extension there's no posix_getuid and if the user
> did 'su' and not 'su -' then the USER environment variable may not be
> root.
>
> Any other ways?
>

For what it's worth, on my linux box, su root results in the same
thing as su - root, uid==0.

It may depend on the shell in use, I don't know, but it seems pretty
important unixwise to return the correct UID no matter what the
environment says.

-- 
Chris Snyder
http://chxo.com/
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to