Replace shell_exec('hostname') with gethostname()

Some hosts have disabled shell_exec() for security reasons. Using gethostname() avoids that limitation, giving same results.

Props: @lat9