php - Will the "get_current_user()" function work on Linux/OSX? -


i learned php morning , i'm writing simple php script planning use scheduled task everyday. script working fine features want add later on, use get_current_user() function from.

my question is: is get_current_user() cross-platform compatible?

i'm not entirely sure because i'm still new scripting language. appreciated. thank you!

get_current_user work on posix based systems (linux, mac, etc)

make sure understand function does. returns owner of script (file), not process owner. if script file owned root, run user "jamie", get_current_user() return root.

to process owner, use snippet first comment in get_current_user php docs

<?php $processuser = posix_getpwuid(posix_geteuid()); print $processuser['name']; ?> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -