command line interface - Does a PHP script executed with exec() from a web-accessible endpoint have access to $_POST? -


i have web service endpoint needs invoke developer's cli php script part of run. pseudocode so:

function startcli($input, $output){    $cmd = escapeshellarg('php bin/startcli.php $input $output');   exec($cmd, $output, $ret);    if ($output){     print_r($output[0]);   } } 

now, might asking: why not pass $_post['var'] clistart.php script?

well, pay when legacy code overseas, sometimes, , time take me take apart system , put greater time have implement whole solution.

so let's stipulate cannot add new variables clistart.php script, , take there. hell, take academic exercise. cli script executed web-requested php script have access $_get or $_post run?

update: i've tried both adding keys $_env , getenv() , putenv(), result same - can update environment current script , child script it's executing queue job, since jobs being run persistent process has own $_env context, there doesn't appear way pass variable along persistent process' context.

i'll either have resort database or file touch, unless has idea.

$_get , $_post part of scripts web request context , won't available in cli, have it's own context populated.


Comments