Troubleshooting WordPress PHP error: Constant FS_CHMOD_FILE already defined

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.

The error

Say you try to visit your WordPress site and you see the following error block instead of your homepage:

Screen_Shot_2023-01-13_at_9.24.06_AM.png

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.

Adjusting wp-config.php

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.

Screen_Shot_2023-01-19_at_8.09.02_AM.png

Scroll down until you find wp-config.php file, which is typically near the bottom.

Screen_Shot_2023-01-19_at_8.09.11_AM.png

Select the wp-config.php file and click Edit in the toolbar at the top of the screen, then accept the popup.

Screen_Shot_2023-01-19_at_8.09.16_AM.png

Screen_Shot_2023-01-19_at_8.09.21_AM.png

Scroll down in the file until you reach the line mentioned in the error log. In our case, it's line 106.

Screen_Shot_2023-01-19_at_8.09.44_AM.png

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.

Screen_Shot_2023-01-19_at_8.23.41_AM.png

Screen_Shot_2023-01-19_at_8.23.46_AM.png

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.

Screen_Shot_2023-01-19_at_8.30.16_AM.png

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.

Screen_Shot_2023-01-19_at_8.39.48_AM.png

Save Changes and reload your site. Things should pop right back up!

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more
Reclaim Hosting Support Hours
8:00 am - 5:00 pm ET, Monday through Friday
Submit a Ticket
Get a quick and helpful response from the pros.
Need Extra Support?
No problem, we're here to help! Talk to us about Professional Services or custom Service Level Agreements.