http://ns1.php.gr.jp/pipermail/php-users/2005-March/025318.html
↑に書いてあることと同じ相談です。
レスを参照して、サンプルソースを組んだ見たのですが、
どうもうまく動作しません。
---------------
$theFile = ”test.avi”;
header (”Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header (”Content-Type: application/octet-stream”);
header (”Content-Length: ” . filesize($theFile));
header (”Content-Disposition: attachment; filename=movie.avi”);
readfile($theFile);
ob_end_flush();
exit;
---------------
$theFile = ”test.avi”が小さいファイルの場合は、正常に動作します。
ob_end_flush()の使い方が悪いのか、
readfile($theFile)の使い方が悪いのか、
そもそも見当違いなのか、
填りだしているので、解決方法をご存じの方が
いらっしゃいましたら、ご教授願います。
http://jp2.php.net/manual/ja/function.ob-end-flush.php
PHP: ob_end_flush - Manual
他に要因がないとして、このソースだけ拝見させていただくと、ob_end_flushは出力のバッファリングをオフに指定する関数なので、readfileとob_end_flushを逆にしてみると、うまくいくかもしれないです。
うまくいかなかったら、ごめんなさい。
試してみましたが、うまくいきませんでした。
他の要因を疑ってみているのですが、
apacheのエラーログは以下の通りです。
Failed loading /usr/local/Zend/lib/ZendOptimizer.so: /usr/local/Zend/lib/ZendOptimizer.so: cannot open shared object file: No such file or directory
Allowed memory size of 134217728 bytes exhausted (tried to allocate 21 bytes)
やはり、メモリですね。
引き続き募集いたします。
-----------------------------------------
色々やってみて、自己解決しましたので閉じます。
readfileを使わなければうまくいきました。