Search the blog

PHP can run under CLI (Command Line Interface) as well as via HTTP. If you want to restrict a script to CLI-only use this simple check:

if (php_sapi_name() != 'cli') {

    exit('ERROR: Not in CLI mode' . PHP_EOL);

}
Tim Bennett is a Leeds-based web designer from Yorkshire. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.