If you see the error "Failed to read FastCGI header" in your app's Apache error log file at log/APPNAME/APPNAME_apache.error.log, there are three most likely causes:

  1. A bug in the app's PHP code, such as a buggy WordPress plugin
  2. A bug in a PHP extension you've added to your server
  3. Your server running out of memory

When this error occurs, the response sent to the browser will be "503 Service Unavailable".

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:

/srv/users/SYSUSER/log/APPNAME/APPNAME_phpX.Y.error.log
/srv/users/SYSUSER/log/APPNAME/APPNAME_phpX.Y.slow.log

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.

Restarting PHP

Even if you haven't identified the cause of the problem, you may be able to get your app working again by restarting PHP.

To restart PHP, SSH into your server as root and run the following command as root for your app's PHP version (replace "X.Y" with the PHP version, for example "5.6").

sudo service phpX.Y-fpm-sp restart

Note that if you haven't identified and fixed the underlying cause of the problem, such as the buggy PHP code or PHP extension, the problem may happen again.

Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials
Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution