the problem is that I used ps aux | grep apache which says the apache is running as nobody.
But then I used exec("whoami"), it gives a different result: root or gt. It depends on the owner of the script. If the script is owned by root, whoami is root; if owned by gt, then whoami is gt.
I also checked httpd.conf, the apache user is nobody, group is nobody.
So could anybody explain this thing?
Thank you!
you are using either cgi or fast-cgi ,
to be “nobody” you need to use mod_php (php as an apache module)
http://php.net/manual/en/security.apache.php
http://www.php.net/manual/en/security.cgi-bin.attacks.php
And there is also SuPHP https://serverfault.com/questions/7589/how-do-you-run-a-php-script-as-the-owner