Bluehost is slow and here’s how to fix it

I recently built a new WordPress website for a client. They decided to maintain their own web host account as they have been using Bluehost for a number of years. I didn’t think this would be a problem until we finally launched the website and found that it took approximately 30 seconds to load each page!

The exact same website loads instantly within my staging server hosted at SiteGround so I know that the issue is not with the website itself, but likely instead something with Bluehost and their server configuration.

It turns out that there’s a known issue within Bluehost which causes a very high ‘Time to First Byte’ (TTFB). This is the measurement of time that it takes for the user’s web browser to acquire the first byte of data from the server before it can begin to load the resources from the web page itself.

This issue appears to be caused by the PHP handler that is set within the Apache .htaccess file, which is specific to cPanel’s EasyApache 4 PHP implementation. It tells the website to use php 8.2 when loading php files, which are required for WordPress to function.

Bluehost default htaccess

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.

  AddHandler application/x-httpd-ea-php82___lsphp .php .php8 .phtml

# php -- END cPanel-generated handler, do not edit

On the surface I don’t see anything wrong with this. PHP 8 is the latest version at the time of writing this post after all. However for whatever reason, this appears to be the culprit to our excruciatingly long load times. If we replace the above htaccess code with the following, then it resolves the issue.

Edited htaccess which fixes slow TTFB

# IMPORTANT: This appears to fix the issue in which Time to First Byte (TTFB) takes up to 30 seconds for the website to load
# Set the “ea-php74” package as the default “PHP” programming language.

  AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml

# php -- END cPanel-generated handler, do not edit

That’s right. Simply changing this to PHP v7.4 is all that it takes to fix this. I can’t imagine why but I am certain that it does.

There’s a caveat to this suggested fix. It appears that Bluehost has an automated process in place which will periodically append the initial PHP 8.2 code to your htaccess file. If this happens then the issue will begin to occur again and you’ll need to repeat this process.