XSendFile not working with apache2

After having installed XSendFile module for apache2 (see installation of xsenfile module), I tried to call it from PHP (see sending huge file through php), and the file was not served.

If this is your case, you should read you apache log (cat /var/log/apache2/error.log) and see if you have any error notification from xsendfile module.

cat /var/log/apache2/error.log | grep xsendfile

In my case, I had the following entries:

[Thu Mar 05 23:39:03 2009] [error] [client 127.0.0.1] (20023)The given path was above the root path: xsendfile: unable to find file: <path_to_file>, aa=0

Well, message is not that clear, but if you have a look at the module documentation, you can see that there is a configuration variable that you need to activate in your .htaccess file to “allow sending files not below the path of the Request”: XSendFileAllowAbove (disabled by default)

Let’s do it:

  1. edit your .htaccess file, adding the following line: XSendFileAllowAbove on
  2. refresh your page

That’s it. File should be downloading by now.

sources

2 Comments: Trackback URL | Comments RSS

  1. marco Says:

    is the php snippet you use to teste somewhere?
  2. Wes Says:

    Note that for newer versions of mod_xsendfile the XSendFileAllowAbove directive has been replaced by XSendFilePath which allows you to whitelist paths that xsendfile has access to.

Post a Comment

Your email is never published nor shared. You're allow to say what you want...