Vagrant + Apache Defaults = Corrupted Files

Problem: You just started using vagrant as a development environment and now your getting errors in your javascript files like 'Illegal Character' appended to the file you just edited.
Restoring the edited file from git fixes the error.

Solution: Your problably being hosed by the 'EnableSendfile' directive.
Disable it by adding "EnableSendfile Off" to your apache config file.

Sendfile allows apache to send data from a file without doing a seperate read and send operation. It however doesn't work well with NFS shares.
While I'm not sure how the shared folder in vagrant works, it appears to be impacted by this setting. Here are the apache 2.2 docs for this module.

Thanks to the folks of the virtualbox forums for discussing this issue and possible solutions and preventing me from wasting another day on this issue.

 

derak

 

2 thoughts on “Vagrant + Apache Defaults = Corrupted Files

  1. And thank YOU very much for sharing! This had been an issue that plagued me for a little while. While I searched for it a long time ago and found nothing, I decided to try again. This time your article came up with just the right combination of keywords so that has helped reduce a ton of frustration on my end. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *