What the Error Means
The error message "Failed to read FastCGI header" means that when Apache was communicating with PHP-FPM, the PHP process did not respond properly.
This error does not mean there is a problem with Apache.
Diagnosing Buggy PHP Code
The most common cause of these errors is buggy PHP code in your app.
The best solution is to disable all WordPress plugins, custom themes, and other custom code until you identify which code is causing the problem.
You may find more information in the app's PHP error log or PHP slow log. You can find these log files at:
where "X.Y" is the version of PHP your app uses, for example "5.6".
If you see errors in these files, it likely means you have a bug in your app's PHP code, such as in a WordPress plugin.
For example, if you have slow scripts, a cascade of problems caused by the slow scripts can ultimately result in PHP not able to respond to requests anymore. In this case, the solution is to fix the slow PHP code.
Diagnosing Buggy PHP Extensions
If you have added custom PHP extensions, such as New Relic or any PECL extension, one of them may be buggy. If you are using any third-party extensions, see our article on identifying problematic PHP extensions.
Running Out of Memory
If your server runs out of memory when handling a PHP request and the PHP process was using a lot of memory, the PHP process handling the request will crash.
If you see errors like Out of memory: Kill process ... (php-fpm) in your server's /var/log/syslog file, this is the cause of the errors you're seeing.
The best solution in this case is to upgrade your server to one with more memory.
You may also want to reduce PHP and WordPress memory usage.