cannot modify header information error (randomblock)
kmaisch
Joined: 2004-04-26
Posts: 79 |
Posted: Fri, 2005-04-15 08:14 |
Please see my main page at http://www.kmaisch.com Since upgrading from 1.4.4 to 1.5 my randomblock gives the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/kmaisch.com/httpdocs/index.php:8) in /home/httpd/vhosts/kmaisch.com/httpdocs/gallery/lib/lang.php on line 356 I have deleted the randomblock cache files. Any ideas? |
|
Posts: 16
I have the exact same situation on the custom front page of my site where I'm displaying the random photo. The random photo is displayed, but with the "cannot modify header information" warning.
I also just upgraded today from 1.4.4 to v1.5-RC3. Is this a know problem?
Posts: 79
ah, so I'm not the only one at least.
Anyone have a fix for this? The randomblock works fine on its own... it just spits out that error when it is inserted onto another php page.
sethp - let me know if you find a solution!
Cheers,
Kim
Posts: 2322
Make sure that you're including the random block via HTTP, not via file.
Read the tutorial at the top of this forum.
Posts: 79
in my index.php page on my main website, i have inserted:
That should work, shouldnt it?
Kim
Posts: 2322
No.
You need to use http://yourhost/gallery/block-random.php
Posts: 79
tried that but i get URL file-access errors:
Posts: 16
I changed my include() statement to point to the URL as signe suggested, and that removed the headers warning for me. Thanks, signe.
Something must have changed with block-random.php or gallery related to this, because the include("/serverpath/gallery/block-random.php"); call use to work for me.
Good luck, kmaisch.
Posts: 3236
You could probably also open up that block-random.php file and locate any place that outputs header stuff like <html> etc and comment out or delete it. I think that the changes were made so that the file could be its own stand-a-lone page and actually validate.
Posts: 2322
That's not the issue. The problem is that the random block is trying to send header information and it has already been sent by the page that's including it.
Posts: 3236
Right, and if you remove all the code that CAN send header information wont that fix the problem? If there isn't anything sending header info, how can you get the error? I would save the file as a new name though so upgrades and stuff don't fork you over.
Posts: 79
So might fryfrog's suggestion work? I'll give it a go...
Posts: 3236
I think it would, but obviously signe doesn't... and on the scale of Gallery devs... I am at the bottom and he is not... so I would not wager on me! But I would still try it because I am very daring! And really its just code
Posts: 2322
No... the issue isn't with the block, it's with the page it's included in.
Since the page has already sent text (the body) and the block is in the middle of the body, the block can't send headers, hence the error.
The *only* way that the random block works successfully is with http includes.
Posts: 79
Well, it did work fryfrog, however I had to delete something from lib/lang.php which probably really should stay in.
I went to line 356 and deleted:
It also had a bit before saying **this check is to ensure header information is not sent if it is already sent** - but I guess this check doesnt work?
Also - because my server does not allow URL file-access with PHP Safe Mode I had to use:
Signe - how can I get it working using http includes? Is this Sever Side Includes stuff (shtml).
What else would that lang.php stuff that I removed affect? I've given my gallery a good going over and everything else seems to work still...
Kim