code_junkie

What is the canonical way to determine commandline vs. http execution of a PHP script?

Nov 11th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.10 KB | None | 0 0
  1. $_SERVER['REMOTE_ADDR']
  2.  
  3. define('CLI',PHP_SAPI==='cli');
  4.  
  5. <?php CLI or die('not allowed');
Add Comment
Please, Sign In to add comment