detect php cgi binary because people keep trying to run service scripts using it

This commit is contained in:
Andrew Dolgov 2014-02-06 23:03:05 +04:00
parent 878a0083ff
commit 6f61ba46c4
2 changed files with 14 additions and 0 deletions

View File

@ -42,6 +42,13 @@
$options = getopt("", $longopts); $options = getopt("", $longopts);
if (!is_array($options)) {
die("error: getopt() failed. ".
"Most probably you are using PHP CGI to run this script ".
"instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ".
"additional information.\n");
}
if (count($options) == 0 && !defined('STDIN')) { if (count($options) == 0 && !defined('STDIN')) {
?> <html> ?> <html>
<head> <head>

View File

@ -29,6 +29,13 @@
die("error: This script requires PHP compiled with PCNTL module.\n"); die("error: This script requires PHP compiled with PCNTL module.\n");
} }
if (!is_array($options)) {
die("error: getopt() failed. ".
"Most probably you are using PHP CGI to run this script ".
"instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ".
"additional information.\n");
}
$master_handlers_installed = false; $master_handlers_installed = false;
$children = array(); $children = array();