Re: Detect local or remote call?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/11/07, Anders Norrbring <lists@xxxxxxxxxxxx> wrote:
>
> Is there a good way to detect in a script if it's called locally from
> command line, or via a remote browser?
>
> Anders


maybe not the best, but works for linux:

<?php
if(isset($_SERVER['SHELL'])) {
    echo 'cli script' . PHP_EOL;
} else {
    echo 'web script';
}
?>

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux