Answer the question
In order to leave comments, you need to log in
Why does the site freeze when I launch an external program?
Good afternoon! There is a small site (running on an nginx server) that generates video using ffmpeg and gives it to the client for download.
The code:
header('Content-type: video/mp4');
$cmd = "ffmpeg -i file.mp4..."
$process = proc_open($cmd, $descriptorspec, $pipes, getcwd());
if (is_resource($process)) {
while(!feof($pipes[1])){
$chunk = fread($pipes[1], 500*1024);
$stdout_size += strlen($chunk);
if ($chunk !== false && !empty($chunk)){
echo $chunk;
if (ob_get_length()){
@ob_flush();
@flush();
@ob_end_flush();
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Add workers in php-fpm pool config
You can also try updating php-fpm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question