Apache and Samba / CIFS

Looks like apache can have a problem reading from data on a samba mount-points.

The problem I was having was that data was being truncated:

user@host:~$ curl -O http://example.org/path/to/largish_file
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 11 97127   11 11343    0     0  1447k      0 --:--:-- --:--:-- --:--:-- 8484k
curl: (18) transfer closed with 85784 bytes remaining to read

While the same apache was returning full versions of files that were not on the samba mount-point.

I noticed this forum comment: http://forums.devshed.com/bsd-help-31/apache-can-t-read-samba-shares-147029.html#post844159

I didn't need to use disable EnableMMAP - this configuration change was all I needed:

EnableSendfile Off

The manual (http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile) indicates that this option (when enabled) means that apache can pass data transfer of static files direct from the kernel to the client without having the data go through apache. In this case it seems that this access fails and having apache read the data itself is a way around the problem.

BradsWiki: ApacheAndSamba (last edited 2010-07-06 15:17:57 by BradleyDean)