Forum Moderators: open

Message Too Old, No Replies

Problem with wordpress

         

jimmychuang

1:14 am on Jun 15, 2008 (gmt 0)

10+ Year Member



After I active couple of plug-in, I got following message when I open login page:

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?

eelixduppy

3:02 am on Jun 16, 2008 (gmt 0)



There is something being output to the browser before the call to the header() function in that particular script. This could be whitespace, HTML, etc, and may ever come from an included file. You must find out where this output is coming from and rearrange a few things so that the redirect occurs before ANY output is sent to the browser.

ergophobe

5:53 pm on Jun 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It says "line 694" so I suspect it is a few blank lines after the end of the code.

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.

ergophobe

5:55 pm on Jun 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is this the same problem that you already asked about in this thread:

[webmasterworld.com...]

jimmychuang

12:45 pm on Jun 18, 2008 (gmt 0)

10+ Year Member



Hi, ergophobe

I have tried several times. But the same problem always happen again after I fix it.

If I want to hire someone to fix it, how much should I pay for him?

eelixduppy

4:05 pm on Jun 18, 2008 (gmt 0)



>> If I want to hire someone to fix it, how much should I pay for him?

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.

ergophobe

5:15 pm on Jun 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry, I meant to say that the extra text should be at line 57 of wp-config.php. I was thinking backwards ;-

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.

jimmychuang

5:18 am on Jun 19, 2008 (gmt 0)

10+ Year Member



Hi, ergophobe. I have copied it and pasted on my wp-config.php. It worked well in the beginning, but after I logged-out, the same thing happened. I got below message:

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

eelixduppy

12:07 pm on Jun 19, 2008 (gmt 0)



>> I don't think this is a plugin problem.

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.

jimmychuang

3:29 pm on Jun 19, 2008 (gmt 0)

10+ Year Member



My hosting company changed the permission of wp-config.php to 644. And it's now ok. (By far)

ergophobe

3:33 pm on Jun 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



[EDIT: looks like Jimmy posted while I was posting]

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.