Situation:
I have a PHP application where I need to get some output from exec()
commands.
exec()
commands are used on different locations throughout the application.
When a user opens multiple pages in the same browser, the exec()
commands are allways executed sequentially; If a user opens a second page, the second page waits for the exec()
command of the first page to finish, before executing.
If I open a second page in a different browser, or in incognito, this problem does not occur.
Example test code:
$exec = "notepad.exe"
$data = shell_exec($exec);
echo $data;
When running this code in the browser, the browser waits for the notepad process to close. When running the script a second time simultaniously, the second notepad process is only started when the first one is closed, unless it's ran from a different browser.
Question:
How can I run multiple exec()
commands simultaneously from the same browser (in different tabs) while still beeing able to catch the output.
Tested on Apache 2.4 running PHP 5.4.7