How can I tell from within my PHP script if it is executed with super user rights?
If it isn’t called like sudo php script.php I can throw an error
if (!is_sudo()) {
die('Please execute with sudo');
}
I am sure there’s a simple way to check, but I just didn’t found it yet
You can use posix_getuid() (0 is
root):as @Dave Random suggested: