Scenario: Greeted with a completely blank white screen when visiting wordpress_site/wp-admin instead of the expected login screen.
Error Encountered – “Warning: Cannot modify header information – headers already sent by (output started at /home/html/wp-config.php:1) in /home/html/wp-includes/pluggable.php on line 1223”
This is what I encountered on someone’s WordPress site today while attempting to simply remove a plugin. One quick change took me down a troubleshooting rabbit hole.
TL;DR Solution: Updating PHP to 7.2 fixed it for me—YMMV.
First Steps
So first, I cleared my browser cache and tried reaching the site in incognito mode. I attempted it with a different browser and even over a VPN. Because it was sitting on a “Managed” platform, I logged into the platform’s backend web dashboard and from there attempted to reach the WordPress dashboard through its admin side. That too failed.
The Next Obvious Steps
From there, I thought I was looking at some plugin conflict. I was a bit unsure about this though since no changes were made to the site and I knew that the WP dashboard had been accessible after the last update to WP 4.9.9 and a plugin to disable Gutenberg (just to be ahead of the game). Still ….
I did the next logical thing and SFTP’d into the server (always set up SFTP access in advance for just such times).
In the interest of time, I just disabled all of the plugins in the html/wp-content/ folder by renaming the html/wp-content/plugins to html/wp-content/plugins-test. By renaming the folder, I was actually disabling them and hopefully fixing my problem.
It didn’t fix my problem.
Next, I went into /wp-content/themes, located the current theme the site was using and relabeled that folder.
It didn’t fix my problem.
Debug Mode
I should have started here, but I was pretty confident that the steps above would have allowed me to reach the login screen though. I was wrong.
So next, I went back and SFTP’d to the server’s html folder and opened up the wp-config.php file. Within the file I found this line define('WP_DEBUG', false);
and changed it to define('WP_DEBUG', true);
When I then attempted to reach the WP login screen once more, I was finally greeted with this error now that debug mode was enabled:
Warning: Cannot modify header information - headers already sent by (output started at /home/html/wp-config.php:1) in /home/html/wp-includes/pluggable.php on line 1223
Well, I opened up the wp-config.php file and checked line 1 to see if there were extra spaces or line breaks that shouldn’t have been there. In theory this was where the conflict would likely be: wp-config.php:1. In reality, it looked fine though. I checked the file’s encoding and didn’t see anything wrong. It was encoded in UTF-8 (no BOM).
Side-channel (You don’t need to read this part)
Throughout this, I had made several calls to the hosting company. I wanted to be sure the server wasn’t hanging or that they weren’t experiencing a known issue. So with their experienced support staff, we were all scratching our heads together.
Of course there was a pay-for option to have another dev look at it. It isn’t my nature to give up on bugs though. I want them squashed while learning something from the process.
Back to the show
I didn’t have access to the cache settings (“managed” platform—remember), but the hosting support agent was able to clear it with the tools he had access to. We pretty much repeated steps and he was as much stuck as I was.
The last thing he noticed before we gave up was that the PHP version was still on 5.X. He thought we should try and upgrade it. Since I’ve had success with PHP 7.2, I gave the ok and viola.
Fireworks here.
It resolved the issue. I was now able to successfully login to the WP dashboard.
Key Learnings
This was a “managed” platform that automatically pushed out WordPress 5.0.3. Since the website was working fine before this, it’s possible that the update created the problem. This might be a lesson to stick with good old C-panel and manage updates manually instead of relying on the unknown whims of managed accounts.
Maybe this is one more reason for me to really dislike the whole Gutenberg release, but it’s still important to keep things updated for security reasons. (There is a Disable Gutenberg plugin that I hear good things about—wink).
If you encounter this issue, you might want to try the PHP upgrade. Most hosts make it pretty easy (even on C-panel it’s just a click away). PHP 7.2 has benefits that make it worthwhile. I know that WP Engine has a plugin that will actually test for compatibility issues if you want to try it first before upgrading. I haven’t used it, but maybe you’ll get good mileage from it.
I just wanted to jot down this experience in case it’s helpful to anyone else who comes across this issue (especially since most WP Sites are still running pre-Gutenberg code).
ciao
[Update] I came across this article and wanted to add it for reference.