Is it possible to pass a $_SERVER variable to a PHP script via the command line?
Specifically I am trying to set the $_SERVER[\'recipient\'] manually so I can test e
The answer by @sberry is correct.
...but because I came to this page looking for setting default values for the $_SERVER
array, when running PHP from command line, here is my own answer. Hope it might help somebody.
empty( $_SERVER['HTTP_HOST'] ) && $_SERVER['HTTP_HOST'] = 'localhost';
empty( $_SERVER['REQUEST_URI'] ) && $_SERVER['REQUEST_URI'] = '/';
empty( $_SERVER['DOCUMENT_ROOT'] ) && $_SERVER['DOCUMENT_ROOT'] = __DIR__;
print_r( $_SERVER );