Page MenuHomePhabricator

Warning: Cannot modify header information
Closed, InvalidPublic

Description

Author: ekompute

Description:
I am trying to use the SpecialDeleteOldRevisions function but encountered the following error:

: Warning: Cannot modify header information - headers already sent by (output started at
: /home/ekomrinf/public_html/ekompute/LocalSettings.php:149) in : /home/ekomrinf/public_html/ekompute/includes/WebResponse.php on line 10

When I tried to install Adsense in my LocalSettings.php, I encounter a similar error too:

: Warning: Cannot modify header information - headers already sent by (output started at
: /home/ekomrinf/public_html/ekompute/adsense.php:4) in
: /home/ekomrinf/public_html/ekompute/includes/WebResponse.php on line 10

What could be the possible cause? — ~~~~


Version: 1.10.x
Severity: enhancement
URL: http://e-komputer.info

Details

Reference
bz11272

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 21 2014, 9:55 PM
bzimport added a project: MediaWiki-Interface.
bzimport set Reference to bz11272.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Sep 10 2007, 9:02 AM

You have some blank lines at the end of your LocalSettings.php. On line 149.

ekompute wrote:

Hi, I have checked but there is no blank lines on line 149. The pertinent section of LocalSettings.php reads:

$wgAvailableRights[] = 'DeleteOldRevisions';
$wgGroupPermissions['sysop']['DeleteOldRevisions'] = true;
include_once("$IP/extensions/SpecialDeleteOldRevisions.php");
#include_once( "$IP/adsense.php" );
?>

Line 149 is:
: include_once("$IP/extensions/SpecialDeleteOldRevisions.php");

robchur wrote:

Try checking the file specified for blank lines or byte-order marks at the start of the file, and remove the "?>" tag from the end of the file, if present.

ekompute wrote:

Hi, I have checked and rechecked but there are no blank lines or byte-order marks at the start of the file nor blank lines at the end. I have removed the "?>" tag from the end of the LocalSettings.php file (I put it there earlier thinking that the closing tag was missing.)

I uploaded the mediawiki-1.10.1.patch(3).sig into the same directory as my LocalSettings.php but did not install because I don't know how. Could that be the problem?

ekompute wrote:

Hi, I have version 10.0.0 previously installed with WAMP in my personal computer. I have just tried exactly what I had done for SpecialDeleteOldRevisions function in my webhost server and managed to get it up without a single hitch.

I then copied the WebResponse.php from version 10.0.0 in my personal computer into version 10.0.1 in my webhost server. However, the error message still persist. Could there be a bug in 10.0.1? (I have not installed the security patch, mediawiki-1.10.1.patch(3).sig, as it sounds quite complicated. I think the problem is not related, unless it is.)

ekompute wrote:

Hi, I have been trying on my own. As I am having two websites:

  • one hosted by Siteground in USA (using Mediawiki 10.0.0);
  • one hosted by Internet-Hosting in Malaysia (using Mediawiki 10.0.1);

I decided to copy the SpecialDeleteOldRevisions file from Internet-Hosting to Siteground. It works immediately without a single problem! (see http://e-holidaymaker.info/wiki/Halaman_Utama). I then try again on the Malaysian website, but it just refuse to work (see http://e-komputer.info/wiki/Halaman_Utama). I wonder why. I have asked my webhost to enable exec() to see if it works.

As for Adsense, both sites show the same error message with the same set of changes, ie. Warning: Cannot modify header information. However, I try another Adsense version for http://e-holidaymaker.info/wiki/Halaman_Utama and it works but I couldn't get it on the right column yet. (I think I may be able to resolve this right column thing in due time.)

ekompute wrote:

Awww! Sounds like a really hard nut to crack. If a solution is not forthcoming here, no other place will be able to assist me, LOL.

ekompute wrote:

Hi, I am at the end of the road. All recommendations have been implemented but the problem cannot be resolved. I do not encounter any problem with SpecialDeleteOldRevisions for Version 10.0.0 in both my personal computer and my website hosted by Siteground.

As I am now suspect the possibility of a bug in 10.0.1, is it possible for me to downgrade from Version 10.0.1 to Version 10.0.0 that has served me so well? How do I go about doing it?

brion added a comment.Sep 13 2007, 3:21 PM

You have extra space (probably blank lines), probably at the start or end of LocalSettings.php or one of the customized files you have edited or uploaded.

You'll have to check the files and remove the extra space.

ekompute wrote:

Hi Brion Vibber, thank you for your response. In the very first response to this thread, Andrew Garrett and subsequently both Rob Church and my webhost at Internet-Hosting have informed me of the extra space or blank lines. I checked and rechecked but I could not find any.

Frustrated, I copied both the SpecialDeleteOldRevisions.php and LocalSettings.php files from my MediaWiki Version 10.0.1 software (hosted by Internet-Hosting) into my MediaWiki Version 10.0.0 softwares installed in both my personal computer and in my website hosted by Siteground. It worked immediately without a hitch (see Delete Old Revision link at bottom of page http://e-holidaymaker.info/wiki/Khas:Specialpages).

In view of this, I concluded that there were nothing wrong with the two relevant files. Why would the same files work in one version and not the other? I am working on two assumptions. Either there is something wrong with Version 10.0.1 or there are some security features installed by my webhost that is causing the problem.

Installing MediaWiki in my personal computer has been a breeze. I have done it many times, each time I reformat my computer, and also in helping others to instal into their computers. However with Siteground web server, there were times when I had to ask them for assistance, eg. installing Tex and ImageMagick. I have asked Internet-hosting to enable exec() so that ImageMagick could work but they declined because of the security risk. However, Siteground did enable ImageMagick for me.

ekompute wrote:

Sorry for being a pain in the ass but this is my final two destinations (the other being my webhost). All other attempts, including at MediaWiki Project Support Desk, have failed.

Actually, I am transferring my website from Siteground to Internet-hosting because of a lack of viewer traffic. As you can see, my Siteground website at http://e-holidaymaker.info/wiki/Halaman_Utama works perfectly as I intended. (I transferred ALL the relevant files from Internet-hosting a moment ago to Siteground and it works without a hitch!)

Already at the end of my wits, I used Kepner and Tregor problem-solving technique and by a series of elimination, boil down the problem to two major changes:

  • a switch from Version 10.0.0 to Version 10.0.1
  • a switch of webhost from Siteground to Internet-Hosting.

From what I gather here, the switch to Version 10.0.1 is not the cause. So that would boil down to the webhost, with its different settings (possibly security settings). I note that Siteground added one line for me in my LocalSettings.php, ie:

$wgDiff3 = "/usr/bin/diff3";

Could this be the difference why it works in Siteground?

robchur wrote:

I've already advised you on this matter privately, I think. Please note that this bug tracker is not a support forum; such discussions are better off on mediawiki-l or other mailing lists.

You may like to try disabling any extensions you have installed, and then re-enabling them one at a time to see which is the culprit.

ekompute wrote:

Hi, I have managed to solved the two issues by shifting the DeleteOldRevisions.php and Adsense.php from the extension folder up one level. Thanking all of you for your kind assistance.