apache - Executing multiple exec() from PHP -
situation:
i have php application need output exec() commands. exec() commands used on different locations throughout application.
when user opens multiple pages in same browser, exec() commands allways executed sequentially; if user opens second page, second page waits exec() command of first page finish, before executing. if open second page in different browser, or in incognito, problem not occur.
example test code: $exec = "notepad.exe" $data = shell_exec($exec); echo $data;
when running code in browser, browser waits notepad process close. when running script second time simultaniously, second notepad process started when first 1 closed, unless it's ran different browser.
question: how can run multiple exec() commands simultaniously same browser (in different tabs) while still beeing able catch output.
tested on apache 2.4 running php 5.4.7
the issue combination use of sessions described here: https://bugs.php.net/bug.php?id=44942
solution: while using sessions, need call session_write_close(); before running exec() command.
Comments
Post a Comment