How to determine if php script is running from command line

if (defined('STDIN'))
  print("Running from command line\n");
else
  print("Not running from command line\n");