0

i have the following intallation on cents 6.

apache version :Apache 2.0
httpd-tools-2.2.15-28.el6.centos.x86_64
httpd-devel-2.2.15-28.el6.centos.x86_64
httpd-2.2.15-28.el6.centos.x86_64 .

in httpd.conf i have added the line: LoadModule xsendfile_module /usr/lib64/httpd/modules/mod_xsendfile.so

and apache_get_modules(); shows mod_xsendfile in loaded mod array... Now i have the .htaccess file which contains

<Files files.php>
XSendFile on
</Files>

and the files.php have

$path='fileliste.txt';
$documentMIME="text/plain";
$modules = apache_get_modules();
if (in_array("mod_xsendfile", $modules)) {
header ("X-Sendfile: ". $path);
header ("Content-Type: " . $documentMIME);
//header ('Content-Disposition: attachment; filename="textfile"');
}

every things seems corrects. but still it is not show any file.

Black Sea
  • 124
  • 1
  • 9
  • # AllowOverride controls what directives may be placed in .htaccess AllowOverride All. it was not working as AllowOverride was set to none – Black Sea Jul 04 '13 at 12:11

1 Answers1

0

In .htacess file you have

<Files files.php>
  XSendFile on
</Files>

and the files.php is

<?php

 $file = "path_to_your_file";
 $finfo = new finfo;  
  $mime = $finfo->file($file, FILEINFO_MIME_TYPE );
 if (in_array('mod_xsendfile', apache_get_modules()))
 {
header("X-Sendfile: $file");
header("Content-type: $mime");
//header ('Content-Disposition: attachment; filename="image"'); 
 }

?>

dont forget to change cofig AllowOverride All for .htaccess

Black Sea
  • 124
  • 1
  • 9