PHPverse 2025

Voting

: six minus one?
(Example: nine)

The Note You're Voting On

Arno van den Brink
16 years ago
This will execute $cmd in the background (no cmd window) without PHP waiting for it to finish, on both Windows and Unix.

<?php
function execInBackground($cmd) {
if (
substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
?>

<< Back to user notes page

To Top