You've updated and consolidated your plugins, updated your theme, and your WordPress application, but you're still getting an error when trying to change your PHP version to 8.0. What gives?
While making these updates will often be enough to get your site up to speed with PHP 8.0, sometimes there are other underlying issues in your site setup that can keep you from your 8.0 dreams.
This guide will take you through seeing a persistent error on your WordPress site, decoding it so it makes sense, and ultimately fixing it. While this guide will cover a specific error, these general troubleshooting skills will help any WordPress administrator to approach any error with confidence.
Say you try to visit your WordPress site and you see the following error block instead of your homepage:
While, at first glance, this may seem overwhelming and unintelligible, it's actually giving us a lot of really helpful information that anyone, not just programmers, can understand once they dive in.
So, what's the error? Well, we can pretty confidently pull out two pieces from this log:
Constant FS_CHMOD_DIR already defined and
Cannot modify header information. It even tells us where we can look in our files to see what it's referring to: wp-config.php.
Even if we don't know exactly what's going on yet, we do know that a good place to start is by opening the wp-config file in our site's directory in File Manager.
To find the wp-config.php file, go to your cPanel's File Manager then navigate to the directory where your affected site lives. In our example, the site is our primary site in our public_html folder.
Scroll down until you find wp-config.php file, which is typically near the bottom.
Select the wp-config.php file and click Edit in the toolbar at the top of the screen, then accept the popup.
Scroll down in the file until you reach the line mentioned in the error log. In our case, it's line 106.
As far as we know, that's how things are supposed to look, right? Fortunately, since the wp-config.php file is based on a default file shipped with all fresh WordPress installations, we can easily find how the file is supposed to look in its original form.
Go back to your public_html folder in the previous browser tab and locate the wp-config-sample.php file just above your wp-config.php file. Select this file and click View in the above toolbar.
Scroll all the way to the bottom of this file, because we know from the wp-config.php file that the code we're looking for will be at the very bottom.
Now we can see that the code included in our current wp-config.php is not typical for this file type.
Returning to the tab with your wp-config.php file, comment out the out-of-place code block using **/ at the beginning of the block and */ at the end.
Save Changes and reload your site. Things should pop right back up!