Forum Moderators: open
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:57) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 694
How to fix it?
I don't know why WP developers insist on including the php closing tag in every file (i.e. the <? tag) even though the official PHP docs say not to do so because it often leads to headers already sent errors.
So at the very end of config.php and pluggable.php, try getting rid of the ?> and see what happens. Otherwise, see what's on line 57 of config.php and line 694 of pluggable.php and make sure there is nothing sending text to the browser.
[webmasterworld.com...]
It depends on what has to be done to fix it.
First, check to see if the plugin that you added is supported by the version of WP you are running. Odds are that it isn't and it's causing you trouble. If it's not compatible, see if you can find a more recent version of the plugin, or maybe you should update your WP installation.
Assuming this is the same as your other problem, I don't think this is a plugin problem. For one, I looked through several versions of WP that I have and none of them have more than 33 lines of code in wp-config.php. Unless you are running mulitple sites off a single codebase using symlinks, I can't see why there would be 57 lines of code.
Please verify that this is WP 2.5.
So, again assuming this is similar to your last problem and something is injecting code into wp-config.php, I'm betting on some other problem with your setup. It just doesn't make sense to me that any plugin would modify the wp-config.php.
So this time around, what's on line 57 of wp-config.php?
wp-config.php should look like this and should have NOTHING more (except obviously the correct values for DB_NAME etc.:
<?php
// ** MySQL settings ** //
define('DB_NAME', 'putyourdbnamehere'); // The name of the database
define('DB_USER', 'usernamehere'); // Your MySQL username
define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');// Change SECRET_KEY to a unique phrase. You won't have to remember it later,
// so make it long and complicated. You can visit [grc.com...]
// to get a phrase generated for you, or just make something up.
define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase.// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = 'wp_'; // Only numbers, letters, and underscores please!// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');/* That's all, stop editing! Happy blogging. */
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?>
Can you get a clean copy, put in the settings you need, upload it back up to the server and set it to read only and see if that stops the problem. That will only stop the symptom though. Somewhow you need to find out what is mucking in there and adding code to your wp-config.php since that may be a serious problem.
So try to change the file permissions to 444 or, if that doesn't work, 555, but in any case something without write permission.
Then you have to figure out what's modifying your file.
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-login.php on line 202
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-login.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 570
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 571
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 574
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 575
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 576
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 577
Warning: Cannot modify header information - headers already sent by (output started at /home/chuang/public_html/income-secrets/wp-config.php:27) in /home/chuang/public_html/income-secrets/wp-includes/pluggable.php on line 694
The only reason I suggested this was because I was getting MySQL errors and header() errors from WP for someone I was working for. It turned out that both were being caused by plugins that weren't compatible with the version of WP they were running. It's worth a shot to at least check to see if they are compatible or not. There are some plugins out there that can cause hard-to-trace problems. This is one of the reasons I don't particularly like WP.
>> I can't see why there would be 57 lines of code.
There could be extra spacing in there, which, as long as it's not going to the browser is fine. Looking at a few of my installations, my files vary based off how many spaces they have, however, I haven't touched them myself.
I'm glad it's working for you, but there is no way that wp-config.php should be getting modified automatically. Setting it to be read only for group and world and read/write for owner is apparently stopping whatever is happening, but you should try to figure out why it's happening. There is something wrong and perhaps malicious on your server. I think the problem is external to your WP install because I can't see anything that would modify your wp-config.php except during installation.
That makes me wonder that if there is something that is writing to your wp-config.php there may still be something that is reading from it, which might not be good either. Very strange, but I would be worried personally.
When I'm messing around in the sandbox (i.e. local access only), I usually leave my wp-config.php wide open (777) and nothing has ever tried to modify it.
[/EDIT]
both were being caused by plugins that weren't compatible
Agreed. That was my first thought as well and in the last thread I asked him to disable all plugins (Jimmy - did you?), but he was getting strange extra code (like a hash followed by javascript) added into his wp-config.php, which is what made me suspicious of the 57 line count this time.
My thought that it wasn't a plugin was based on assuming it was the same problem as the last time, where code is getting added to his wp-config.php automatically.
No plugin should do that? Of course, it could be a new problem.
as long as it's not going to the browser is fine
I was thinking in terms of blank lines after the ?> Why does WP still insist on using the closing tag when it so often leads to a "headers already sent" error even though the PHP documentation says it is optional [us2.php.net] and the Zend Framework actually disallows it in a pure PHP file [framework.zend.com].
[Edit... I guess this isn't necessary now]
Jimmy, answer these questions.
We can't really answer your questions unless you answer ours. Reposting your error messages doesn't really help - it's essentially the same error in all three cases.
- What version of WP are you using?
- Have you tried running it with ALL plugins disabled and does it work under those circumstances?
- after uploading and before trying to run WP, did you set wp-config.php to READ ONLY (chmod 444) as I suggested previously?
- what are lines 25-30 of wp-config.php?
Please answer all questions otherwise we cannot possibly figure out what is happening.