From 3d4d94358be661e3f213da4ded1115635bb7350e Mon Sep 17 00:00:00 2001 From: Reece Alexander Date: Sun, 26 Feb 2017 20:01:18 +1000 Subject: [PATCH] Added check for register_argc_argv Adds a hint to an issue that had me clueless for awhile. I have a strange scenario where my shell user is different to my cPanel Cron Manager and run from two different configurations. This lead to a vicious circle of wondering why it works in SSH, but not within the cron manager. --- cli-script.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli-script.php b/cli-script.php index 7880e9084..f6515247e 100755 --- a/cli-script.php +++ b/cli-script.php @@ -125,6 +125,15 @@ ENVCONTENT; } DB::connect($databaseConfig); +// register_argc_argv: Tells PHP whether to declare the argv & argc variables (that would contain the GET information) +// http://php.net/manual/en/ini.core.php#ini.register-argc-argv +if (!(int)ini_get('register_argc_argv')) { + echo 'register_argc_argv is required to obtain the GET information but is disabled.' + .'Please enable it in your php.ini (' + . php_ini_loaded_file() + .')'; + die(); +} // Get the request URL from the querystring arguments $url = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null;