Welcome to WebmasterWorld Guest from 54.224.17.208

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Problem using XSendfile (PHP, Apache,Cpanel)

XSendfile not working, but PHP works just fine

     
1:18 pm on Jan 9, 2012 (gmt 0)



Hi

I've been banging my head against this quite frustrating little problem for 3 days now and have made almost zero progress. If any one can shed some light on this I would be very grateful.

Our host company has set up and configured XSendfile and we have tested it as working.

We have configured the following in the apache config:

XSendFile on
XSendFilePath /home/beef/shared/


They have applied these settings to all virtual hosts on our server.

If I do a test XSendfile script from

/home/beef/public_html/test.php


This script immediately serves a file in the shared dir. All good so far.

Now we want to try to run this script from

/home/julius/public_html


(julius is a separate cpanel account, but we have a dedicated server and nobody else has access - besides PHP can access cross-account see below).

From this directory, if I do a force-download script:

$file = "/home/beef/shared/pic222.jpg";
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="pic222.jpg"');
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;


This works fine and sends the file with no problems. So it does not SEEM to be a permissions issue (though I could be wrong this is not my specialism)

But from the same directory, if I use the same XSendfile script that works in the other directory):


$file = "/home/beef/shared/pic222.jpg";
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"pic222.jpg\"");
header("X-Sendfile: ".$file);
exit;


It just sends a 0kb file, and no errors. Have tried a myriad of variations to the XSendfile script, but so far no luck.

Does anyone have any ideas why this may not be working?

Thanks for your help.
1:26 pm on Jan 9, 2012 (gmt 0)



Please scratch this - apache configuration file was not configured correctly.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month