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.
2 responses to “Vagrant + Apache Defaults = Corrupted Files”
Thanks for blogging about this… saved us a ton of time.
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.