I am running PHP on a windows machine in XAMPP environment. I using an AJAX request to convert a movie from MP4 to OGG
function convertMovie(movieName) {
$.ajax({
url: 'movieManagement.php?queryType=convertMovie&value='+movieName,
async: true
});
}
and for the PHP code
function convertMovie($value) {
$command = "psexec -d php ".getcwd()."\\movieConverter.php ".$value." > nul 2<&1";
shell_exec($command);
}
and in movie converter the code is something like
//some more code here
if ($fileExtension === 'mp4' || $fileExtension === 'MP4') {
$newFileName = $serverAddress . $tempFileName . "ogg";
$executeCommand = 'psexec -d '.getcwd() . '\\ffmpeg -i "' . $oldFileName . '" "' . $newFileName . '" > '.$serverAddress.'nul 2>$1';
}
shell_exec($executeCommand);
Now my problem is every timeI ruin this browser waits for ajax call return like for ever, however, if I run these commands separately in command shell they work fine. I just want movie conversion to work in background and browser remains free
I know that this question has been asked at least a 1000 times, but I could not find a concrete answer to this. Sorry for my ignorance.