TL;DR: DreamHost kills processes on their shared hosting plans if they run too long, which can screw up all kinds of things in non-obvious ways. To fix it, either disable lots of plugins, or upgrade to a better hosting plan.
I spent too much time this week trying to track down this issue for a friend, so I thought I’d help surface this for anyone else that runs into a similar issue.
The symptoms I saw were:
- Images uploaded to the Media Library resulted in an “HTTP error”, and thumbnails weren’t generated
- The browser error console showed async-upload.php terminating with a 404 error
- Apache’s error log had entries for: Premature end of script headers errors for async-upload.php
It turned out that DreamHost has a procwatch daemon on their shared plans, and it will kill any processes that run too long.
The issue isn’t limited to uploads, that’s just the specific problem I ran into. If you’re seeing “premature end of script headers” in Apache’s error log, then there’s a good chance that procwatch is the issue. You can confirm that by contacting their support.
To fix it, you could go through your theme and plugins and get rid of stuff you not using, and then do a lot of other optimizations. If it’s a business site, though, it’s probably more cost effective to just upgrade to their managed WP hosting service, rather than investing all that time in optimization.