How can I detect if php is running from the command line?

From: Date: Sun, 21 Mar 1999 11:30:03 +0000
Subject: How can I detect if php is running from the command line?
Groups: php.dev 
Request: Send a blank email to php-dev+get-4705@lists.php.net to get a copy of this message
Hi there I've posted two messages on the php-general list regarding cgi security from other users on the same machine when my php3.cgi is setuid. I am trying to find a way of stopping people using php as a general purpose file viewer for my private files. No replies there so I have decided to add some code to restrict opening any files except those ending in .php3. At least then the only thing anyone can see is the parsed output of my scripts. I have found the place in fopen-wrappers.c to add this: It would be better if I could reliably detect in C code if php has been started from the command line. Is there any way of doing this? Thanks Ross Auckland, New Zealand rossk@akamail.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4705) next »