I am trying to setup a web interface to a couple of Mathematica scripts, which in itself is quite simple:
$script = "myScript.wls";
echo shell_exec('wolframscript -print all -format List -file '.$script);
However, how can I make Mathematica execute the script in an already running local kernel, so that it doesn't go through the overhead of spawning a bunch of new ones every time (which ends up being a rather significant part of the HTTP request time)?
I tried doing this: Opening a notebook from command line in an existing front end instance
That's not the answer.