I have a problem with displaying some videos via a php script using readfile(). Some videos give a HTML status 500, others work fine. Something I do wrong, but I have no idea what. Can somebody hint me in the right direction? What might be the reason for error 500 ?
This is a simplified example I tested on my localhost to reproduce the error.
calling script:
<?php
$videofiles=array("1.mp4", "2.mp4", "3.mp4", "4.mp4");
for ($i=0; $i < count($videofiles); $i++) {
?>
<div class="videos">
<video controls>
<source src="video.php?v=<?php echo $videofiles[$i]; ?>" type="video/mp4">
</video>
</div>
<?php
}
?>
delivering script video.php:
<?php
$video=$_GET['v'];
header("Content-Type: video/mp4");
header("Content-Length: ".filesize($video));
readfile($video);
?>
All rights are set correct (if I replace "video.php?v=..." by the direct filepath all videos show). I suspect that it has to do with file size - the larger (> 150MB) are those who do not show, but I don't know... for testing I used videos from the same mobile phone and of the same day without altering them.