Are there alternative functions to exec() that can achieve the same result without waiting for a response?

The issue with using exec() in PHP is that it waits for the command to finish executing before returning a response, which can cause delays in the script execution. One alternative function that can achieve the same result without waiting for a response is proc_open(). This function allows you to open a process for writing, reading, and error handling without blocking the script execution.

$descriptorspec = [
    0 => ['pipe', 'r'],
    1 => ['pipe', 'w'],
    2 => ['pipe', 'w']
];

$process = proc_open('your_command_here', $descriptorspec, $pipes);

if (is_resource($process)) {
    fclose($pipes[0]);
    fclose($pipes[1]);
    fclose($pipes[2]);
    proc_close($process);
}