Hi Guys,

I have a problem to download/open a pdf file

Let me explain you my set up:

I'm running a small cluster with 1 Load balancer using ldirector, 2 webserver running cherokee and php 5.2.x and 1 NFS server which serves all the web files for both web server.

we deployed a small php script in one of the sites to ask if you want to open or download a pdf file (ie TOS.pdf). Problem is that as soon as I click on the link the browser will pop up an error saying that it can download/open the file because the source is not available (if i click the pdf file directly it will open it with no problem). I have tested the script on an apache server and is working ok so I think the problem has to be with Cherokee or maybe fast-cgi.

I have to say that there is nothing in the logs whatsoever and I have checked the permissions and ownership and no joy

any idea will be appreciated.

the code we are using is as simple as

<?php
$file = "path/file.pdf";

if (file_exists($file)) {
                header('Content-Description: File Transfer');
                header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
                header('Content-Transfer-Encoding: binary');
                header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                header("Cache-Control: private",false);
                header('Pragma: public');
                header('Content-Length: ' . filesize($file));
                ob_clean();
                flush();
                readfile($file);
}
exit;
?>

Thanks
Jean Pierre Dentone
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to