Dirty_Programmer
Dirty_Programmer

Reputation: 107

Run Command in Php without wait in browser in Windows

I followed many of ways in windows to make a command run without interrupting browser. Whenever I try to:

exec("ping 8.8.8.8") 

it makes browser to wait for process to complete.

After completion of process it echoes the output.So what i want is to run a command(like ping) without interrupting browser and store output in variable.

In my case I want to show a dialogue until ping is over and show output afterwards.

I tried:

exec(start \B myexecutable.exe)

without success.Also tried

pclose(popen(start \B myexecutable.exe))

Any suggestion is appreciated.

Upvotes: 0

Views: 982

Answers (1)

E_D
E_D

Reputation: 555

Probably late answer but for me this works on Windows & Linux:

if (isWindows()) {
    pclose(popen("start /B php myfile.php -args", 'r'));
} else {
    exec("php myfile.php -args");
}

You need to activate the php directive

ignore_user_abort(true)

Upvotes: 1

Related Questions