I am attmepting to get argv and argc from a cron job. This is what is being retunred in the $_SERVER and they are missing.
Here is the cron:
/usr/bin/php -q /home/uopynwrukuid/public_html/test_arg.php 2 200
Here is what I get:
array(13) {
["SHELL"]=>
string(31) "/usr/local/cpanel/bin/jailshell"
["MAILTO"]=>
string(23) "email@email.com"
["USER"]=>
string(12) "uopynwrukuid"
["PATH"]=>
string(13) "/usr/bin:/bin"
["PWD"]=>
string(18) "/home/h"
["LANG"]=>
string(11) "en_US.UTF-8"
["SHLVL"]=>
string(1) "1"
["HOME"]=>
string(18) "/home/uopynwrukuid"
["LOGNAME"]=>
string(12) "uopynwrukuid"
["_"]=>
string(12) "/usr/bin/php"
["PHP_SELF"]=>
string(0) ""
["REQUEST_TIME_FLOAT"]=>
float(1529521741.2111)
["REQUEST_TIME"]=>
int(1529521741)
}
Anyone know why this is happening? The script worked at some point and has now broken.
Noticing you are running CPanel from your shell, CPanel has a strange habit of using php-cgi as /usr/bin/php instead of php-cli.
php -v
should return a version and (cli) in parentheses like:
PHP 7.0.27 (cli) (built: Jan 9 2018 12:43:14) ( NTS )
If you see cgi or fcgi instead, then you need to find the path to the actual cli version. I believe this is commonly located at /usr/local/bin/php on cpanel servers.