PHP Snippet 1:
$command = '';
$count = 0;
foreach ($executionProcess as $value) {
if($count != 0) {
// parameters quoted:
$command .= " ";
$command .= '"' .$value .'"';
}
else {
// exe
$command .= $value;
}
$count++;
}
$command .= " > nul";
\Log::info('Command: ' .$command);
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", env('PROCOPENERRORLOG') ."procOpenErrors.log", "a")
);
$cwd = str_replace("\\", "/", base_path()) .'/app/Classes/Bericht/Tex/Working';
$env = null;
$process = proc_open($command, $descriptorspec, $pipes, $cwd, $env);
if (is_resource($process)) {
fwrite($pipes[0], '<?php print_r($_ENV); ?>');
fclose($pipes[0]);
echo stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($process);
}