How can a PHP script detect if it has been invoked as a script or from the shell?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-04-19T23:45:36Z Indexed on 2010/04/19 23:53 UTC
Read the original article Hit count: 161

Filed under:
|
|
|

I have a PHP script on a webserver.

This file is invoked via the shell by another program but it could still be run by the webserver in response to an HTTP request.

How can the script determine the way it was invoked?

© Stack Overflow or respective owner

Related posts about php

Related posts about shell