Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-07-23 01:46:29

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Problem logging in - 'cannot modify header information'

This issue just showed up… When logging in to /textpattern, I’m getting this error:

Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/index.php:2) in /nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/index.php on line 34

I don’t know of any changes made to the site, db, code, etc.

http://www.amesandjess.com/textpattern/

Thanks so much for any assistance!

Offline

#2 2010-07-23 01:53:10

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Re: Problem logging in - 'cannot modify header information'

please disregard. after a bit more searching, simply deleted the blank second line from index.php

Offline

#3 2010-07-23 09:03:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: Problem logging in - 'cannot modify header information'

claywso wrote:

please disregard. after a bit more searching, simply deleted the blank second line from index.php

Eeeek, seriously? Would you mind posting your high diagnostics please? I’m just curious why this might be happening and whether it’s a bug and/or something specific to your server or TXP environment (or — long shot — a plugin that’s clashing with the core somehow?)

I can’t see why it should care about the blank line there, but perhaps some versions of PHP or Apache are sniffy about it. Would be nice to track down the circumstances under which it occurs.

Possibly related: someone told me recently that the trailing ?> in TXP’s files can sometimes trigger the White Screen of Death for the same sort of reasons (headers already sent). According to the spec the trailing ?> appears to be optional for full PHP files (with the odd bit of raw HTML in the mix), so if this kind of thing happens I’d favour removing them at some point. It might fix a few other things in the process!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2010-07-23 09:58:14

kritoke
Member
From: Florida
Registered: 2010-07-19
Posts: 26

Re: Problem logging in - 'cannot modify header information'

I had run into this error when using the new txpmobile theme, which is since fixed. The removal of the spaces in the modified index.php in the same textpattern dir fixed it. I am running PHP Version 5.2.13 on my server with the issue and LiteSpeed V5.3 for the web server if that helps diagnose the reason for the error.

Offline

#5 2010-07-23 12:16:01

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Problem logging in - 'cannot modify header information'

Bloke wrote:

Possibly related: someone told me recently that the trailing ?> in TXP’s files can sometimes trigger the White Screen of Death for the same sort of reasons (headers already sent). According to the spec the trailing ?> appears to be optional for full PHP files (with the odd bit of raw HTML in the mix), so if this kind of thing happens I’d favour removing them at some point. It might fix a few other things in the process!

Any whitespace outside the PHP tags can trigger this, if the file is required or included by another file after output has started.

Note that the Zend file formatting guidelines forbid the closing PHP tag. Personally I always omit this tag when possible.

@claywso: Are you saying it was a blank line after the opening PHP tag that caused the error? That leaves me scratching my head. From the error message I would have thought it was a problem with the config.php file (from the reference to index.php line 34).


Code is topiary

Offline

#6 2010-07-23 12:45:49

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Re: Problem logging in - 'cannot modify header information'

here’s the before and after of index.php

before with header error

<?php

/*
	This is Textpattern

after, with no error

<?php
/*
	This is Textpattern

high diagnostic:

Textpattern version: 4.0.8 (r3085)
Last Update: 2009-08-21 12:34:37/2009-08-21 12:29:00
Document root: /home/57222/domains/amesandjess.com/html (/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html)
$path_to_site: /nfs/c03/h04/mnt/57222/domains/amesandjess.com/html
Textpattern path: /nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern
Permanent link mode: section_title
Temporary directory path: /nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/tmp
Site URL: www.amesandjess.com
PHP version: 4.4.8
GD Image Library: version bundled (2.0.28 compatible), supported formats: GIF, JPG, PNG
Server Local Time: 2010-07-23 05:37:13
MySQL: 4.1.25-Debian_mt1
Locale: en_US.UTF-8
Server: Apache/2.0.54
PHP Server API: cgi-fcgi
RFC 2616 headers: 
Server OS: Linux 2.6.33.1mtv2
Active plugins: smd_slimbox-0.33, smd_lib-0.32

Pre-flight check: 
------------------------
Some Textpattern files have been modified: 
	/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/index.php
------------------------

.htaccess file contents: 
------------------------
#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes

<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]

	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php

	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

AddHandler php4-script .php

------------------------

Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: latin1
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
17 Tables: OK

PHP extensions: zip, xslt, xmlrpc/0.51, xml, wddx, tokenizer/0.1, standard/4.4.8, sockets, session, pspell, posix, pgsql, overload, mysql, mime_magic/0.1, mhash, mcrypt, mcal, mbstring, ldap, imap, iconv, gettext, gd, ftp, filepro, exif/1.4 $Id: exif.c,v 1.118.2.37.2.8 2007/12/31 07:22:46 sebastian Exp $, domxml/20020815, dbx, dba, curl, ctype, crack, calendar, bz2, bcmath, zlib/1.1, pcre, openssl, Zend Optimizer

/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/index.php: 
	r2885 (b2215d9fc23dc9aa88c92cdb7e4627f2)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/css.php: 
	r2772 (2a3cef700a253208e1140acfb27b7895)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_admin.php: 
	r3013 (4f25d38445705e8135eafb47fe69c5e6)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_article.php: 
	r3040 (d5e4b175b1f7eec4ca73a0362b943185)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_auth.php: 
	r2856 (c6e17d38408910606b38ea6fbb8e97a8)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_category.php: 
	r3072 (38cb7ab1fca56ec11e66bc7fcb4dcf1d)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_css.php: 
	r3081 (4a0fc4c539e86aef5eb061d6bbaca5ac)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_diag.php: 
	r3060 (0116e33dc27867bc7004f788da2fc610)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_discuss.php: 
	r3071 (9b53af05cd0c1baa8fc99c07c99d3640)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_file.php: 
	r3069 (0dfc75eaa35e524313a40812dfa82886)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_form.php: 
	r3069 (3edf3408cd05fe8e82137735b1bce5c7)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_image.php: 
	r3069 (4c9b3db31c3df354b9055725e9fb2091)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_import.php: 
	r2812 (4401e213b8b68af2001734ac67b85f51)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_link.php: 
	r3069 (0fffe5a42a06327c15064d54ddd5f478)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_list.php: 
	r3069 (256b992e07a9d67acb4334b57fe64cd3)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_log.php: 
	r3003 (942e39aade8d8ccf4232bfc46c6c9902)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_page.php: 
	r3056 (d6aa9f8ad7605fbba705c96710cc1802)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_plugin.php: 
	r3052 (dcd7dc1e43b1479965378dbb802d52e1)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_prefs.php: 
	r2965 (55a6d6e2fa6994e16566c6e1b19d2e1d)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_preview.php: 
	r1238 (c3e3678d655eb19ece72af65b763fd1b)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_section.php: 
	r3072 (0034cc064a65b78900e164d118a0ef8b)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/include/txp_tag.php: 
	r2868 (3ac47c5e472b54b5bc27909581120167)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/index.php: 
	r3085 (5c9c61ab3b989b1a294152536613d9be)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/IXRClass.php: 
	r2932 (a14c1fa6441a4faf1d097d397bf61841)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/admin_config.php: 
	r2812 (b4bb30f62aab58b164ea6c3e6c786b9c)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/class.thumb.php: 
	r3041 (45ed990e57ba5daebe11f274b32626c6)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/classTextile.php: 
	r2812 (76416becc5a4789efbc543c4681041c3)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/constants.php: 
	r3038 (f87766c302fa9275024a06b2351a2411)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/taglib.php: 
	r2868 (b804c3222d47e5b24c16bd3731b5eac9)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_admin.php: 
	r3047 (4adad7711c24f49ecd26b24d80d27884)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_db.php: 
	r3029 (ae35ec3566cfab83178eb0bb6cc6adf5)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_forms.php: 
	r3079 (79a5b4411412a41feb64fea544ef1eb2)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_head.php: 
	r3004 (813dd318366c7f823e5c1202e253c7e9)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_html.php: 
	r2981 (1b048fdbe1f6fec8f052274c2b2c0736)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_misc.php: 
	r3074 (804959a9253b0ad9b472ca8d55965382)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_update.php: 
	r2812 (31a52cb8894ab8d0c81c9c8905d8ab60)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/lib/txplib_wrapper.php: 
	r2931 (81f3780d9972c5fadd478a13a7204d2a)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish.php: 
	r3050 (8c4ad513ead711cf336d17fb7605ce63)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/atom.php: 
	r3029 (2b7568a730855c05eb275125069c17cb)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/comment.php: 
	r3011 (18ab83ecddef7499afdb3ff399973113)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/log.php: 
	r2937 (40cfffaca8aa34c71ab0ad7434a95767)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/rss.php: 
	r3029 (240cef01dd4aa72d32ebf05baa56ccfe)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/search.php: 
	r2812 (e5b4f62da431aec72118414ed2bcd2a2)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/publish/taghandlers.php: 
	r3078 (bfb48cb4ffff860c7b2fc7f635988ec5)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/rpc/index.php: 
	r2998 (d7b0e58e0dac47472401982f2953a5a4)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/rpc/TXP_RPCServer.php: 
	r2998 (95942b5917b4d45d6c0e48d1deb53154)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_1.0.0.php: 
	r3047 (f12fd6e63f344f1802c1f17f854b2ad7)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.2.php: 
	r3047 (cdd0e5fe346c0702eb414f42f9cfbcc6)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.3.php: 
	r3047 (ebef8def3b71b07aa01929f335b7afc6)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.4.php: 
	r3047 (8fd20a90592394a65fbd9b0d6c6a388c)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.5.php: 
	r2894 (6c60b97917192d4f4c4aa4ee377b6329)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.6.php: 
	r3047 (d2f218d57ba0faf018df88825c225e68)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.7.php: 
	r3014 (507a199ad584314f9131152eac028433)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_to_4.0.8.php: 
	r3057 (836b291ed122ced3759b5909c7d442d4)
/nfs/c03/h04/mnt/57222/domains/amesandjess.com/html/textpattern/update/_update.php: 
	r3085 (c9332d78f697754fab18fae5cfea481f)

Offline

#7 2010-07-23 12:48:59

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Re: Problem logging in - 'cannot modify header information'

also, please note that this was only in the /textpattern directory. the live website was functioning correctly.

noticed the error because the site owner couldn’t “login”. she could login, but because of the problems with the header in the tp section, it wasn’t keeping her login active, so each click after login required another login, if that makes sense.

also, site is hosted on mediatemple, which has had a few problems lately (though none that affected this ‘cluster’, i don’t think)

Last edited by claywso (2010-07-23 12:49:12)

Offline

#8 2010-07-23 12:50:42

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Re: Problem logging in - 'cannot modify header information'

sorry for repeat posts. the error mentioned index.php:2, which is what directed my attention to line 2.

Offline

#9 2010-07-23 14:26:04

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Problem logging in - 'cannot modify header information'

Bizarre. Whitespace inside the php tags shouldn’t have any effect on output. And note the reference to line 34: this should only be invoked if config.php is missing. Glad you got it working, but wish I understood why. Any particular reason for running php 4 on this account?


Code is topiary

Offline

#10 2010-07-23 21:41:08

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Problem logging in - 'cannot modify header information'

claywso

This sounds strange to me. As Jeff pointed out already — bizarre. It’s certainly not a result I’d expect.

I guess your client rather not do this — but perhaps it would be helpful to know — can you repeat the error by editing index.php to put the blank line back in on a temporary basis?

Bloke wrote:

Possibly related: someone told me recently that the trailing ?> in TXP’s files can sometimes trigger the White Screen of Death for the same sort of reasons (headers already sent). According to the spec the trailing ?> appears to be optional for full PHP files (with the odd bit of raw HTML in the mix), so if this kind of thing happens I’d favour removing them at some point. It might fix a few other things in the process!

Most php class libraries I’ve looked at omit the php closing tags specifically to avoid whitespace injection into the output stream. Whilst it’s not particularly important for HTML output, which is tolerant of excess whitespace, it certainly can break feeds or XML output IIRC.


Steve

Offline

#11 2010-07-23 22:07:44

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

Re: Problem logging in - 'cannot modify header information'

so, i went in and added a blank line. no error.

added four blank lines. no error.

really odd. any ideas?

Offline

#12 2010-07-23 22:22:52

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Problem logging in - 'cannot modify header information'

Clay

thanks for trying that. I suspect the file you originally edited had some whitespace before the opening php tags that your editor removed. Something like a BOM may have done it. More on this sort of thing here (shame on me linking to a drupal site!)

I suspect that just re-saving the original file from your editor would have solved this.


Steve

Offline

Board footer

Powered by FluxBB