Sending a FLV through PHP


This script will work fine on my WAMP dev server but on the live Linux server I am getting 500 server errors.

The whole point of the script is to keep users from downloading the flv I send to a swf player. Below is my code.

AddType application/x-httpd-php .flv



<?php session_start(); ?> Untitled Document <?php $_SESSION['isFair'] = "Yes"; ?> [/code]

video.flv - Found this script here

if($_SESSION[‘isFair’] == “Yes”)
$filename = “flv/01.flv”;
header(‘Content-Type: video/x-flv’);
header(‘Length: ’ . filesize($filename));
header(‘Content-Disposition: attachment; filename="’.$filename.’"’);
$fd = fopen($filename, “r”);
echo fread($fd, filesize($filename));
fclose ($fd);

echo “Stealing is not allowed”;


I checked my server log and it says
file has no execute permission: (video.flv) so I give it execute permission. Then I get the error
file is writable by others: (video.flv), I take away write permissions and I still get error 500 and “Premature end of script headers:” is put in the log.

Any help will be greatly appreciated.

Problem solved…it was because I was using AddType application/x-httpd-php .flv in the htaccess file.

I should have been using AddHandler application/x-httpd-php .flv

Sponsor our Newsletter | Privacy Policy | Terms of Service