Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Fix the Apache Error ‘Failed to read FastCGI header’?

On our server management plans, our support team will be available anytime to fix all the issues with Apache and FPM.

The issue “Failed to read FastCGI header” in your app’s Apache error log file could be caused by one of three things.

  • A PHP code error in the software, such as a faulty plugin/theme
  • A flaw in a PHP extension that you installed on your server
  • The server RAM is running out

The browser will display “503 Service Unavailable” when this problem occurs. When Apache connected with PHP-FPM, the error message “Failed to read FastCGI header” indicates that the PHP process did not react appropriately.

Fixing PHP Code That Isn’t Working

The most common cause of these problems is your app’s faulty PHP code. The best approach is to disable any WordPress plugins, custom themes, and other custom code until you figure out which code is causing the problem.

The app’s PHP error log or PHP slow log can provide more details. For each application, it could be in a separate location. The wordpress error log, for example, can be enabled in wp-config.php, and the log file will be located at;

 /var/www/html/wp-content/debug.log

where “/var/www/html/” is the domain’s document root, from which the wordpress files are loaded.

If your scripts are slow, for example, a series of difficulties caused by the slow scripts can eventually cause PHP to cease responding to queries. In this case, the solution is to fix the slow PHP code.

Troubleshooting PHP Extensions

One of your custom PHP extensions, such as New Relic or any PECL extension, could be broken. If you’re using any third-party extensions, follow the steps outlined below to identify potentially malicious PHP extensions.

If you see the any corrupted in the global PHP-FPM error log file at /var/log/phpX.Y.log, the most likely cause of the problem is a buggy PHP extension crashing PHP.

Disable the Third-Party PHP Extensions for this. If your logs show “any-extension corrupted,” you should disable all third-party PHP extensions until you can figure out which one is causing the issue.

To disable a PHP extension, log in as root to your server and disable each extension using this file (the php extension loading file may differ across Apache and Nginx servers; the file location may be found in the info.php file) ;

/etc/php.d/extension_name.ini

Next, restart PHP by running this command as root:

sudo service phpx.y-fpm restart

Replace “x.y” with the version of PHP, for example “7.4”

Memory Is Running Low

If your server runs out of memory while processing a PHP request and the PHP process is utilising a lot of memory, the PHP process will crash. Look for any issues related to memory usage in the /var/log/syslog or /var/log/messages files.

You’ve ran out of memory if you notice errors like Out of memory: Kill process… (php-fpm).

Also, check the free memory available in your server by using ;

free -g    (or) 
free -m

In this case, the best approach is to upgrade your server to one with more memory. Reduce the amount of RAM PHP and WordPress utilise as another option.

The PHP process should then be restarted. Even if you haven’t identified the source of the problem, restarting PHP may be able to restore service to your app.

SSH into your server as root and perform the following command as root to restart PHP.

sudo service phpx.y-fpm restart

If you are facing any issues with similar errors on your server, Contact our server experts right now to get it sorted.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.