I am trying to execute a command by using popen
and then print out its progress via AJAX. I have found this post extremely helpful and got the AJAX to script exchange working fine. The problem is that every time there is an async GET to test
from ajax, the handle on popen
is repeated. If I have the shell only run once, then the handle is no longer valid. I can't figure out how to make $handle be persistent accross requests.
public function test()
{
chdir('my dir');
$handle = popen('make install 2>&1','r');
echo fread($handle, 2096);
}
There will only be one user requesting this at a time....only used on the Admin back end of things. The output from AJAX is always, "Making install in src".