I am using following script
<?php
set_time_limit(0);
if(isset($_GET['videoURL']) && $_GET['videoURL']!=''){
$URL=$_GET['videoURL'];
$URL=base64_decode($URL);
//clear all previous buffers start a new one
ob_end_clean( ); ob_start( );
// open file
$handle = @fopen($URL, 'rb');
// Forward headers, $http_response_header is populated by fopen call
foreach ($http_response_header AS $header) {
header($header);
}
//send header information
ob_clean(); flush();
$chunksize = 8*1024;
$buffer = '';
while (!feof($handle) ) {
$buffer= @fread($handle,$chunksize);
print $buffer;
ob_flush();
flush();
}
fclose($handle);
exit;
}
?>
to stream videos to user. The apache2 processes behave normally until one process suddenly starts filling RAM and leads to server crash.
I am not sure but I believe its memory leak issue. If I kill process using PID then everything becomes smooth again otherwise server comes to halt.
Please help me in this regard.
Apache Configuration:
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 20
MaxClients 256
MaxRequestsPerChild 10
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 25
ThreadLimit 10
ThreadsPerChild 10
MaxClients 112
MaxRequestsPerChild 5
</IfModule>