Headers sent even in simplest script, yet work on xBlogLite

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
omega
-


Joined: 26 Jun 2004
Posts: 10
Location: New England, MA

PostPosted: Mon Aug 02, 2004 6:07 am    Post subject: Headers sent even in simplest script, yet work on xBlogLite Reply with quote

Hello, all... on my local host, I'm having a very frustrating problem pertaining to header functions. First of all, the header() and setcookie() functions work fine on the copy of xBlogLite <http://www.infinitywebdesign.com/software/xbloglite/> which is running on my server, so I'm not sure if it IS a server problem. But despite that, in a script with something like "<?php header("Location: http://www.example.com/");?>" it gives the headers sent error, with the line number stated in the error ALWAYS being the line that the header function is on. I've also tried <?php ob_start(); header("Location: http://www.example.com/"); ob_flush(); ?>, but that made no difference. I remember headers worked when I first started with Abyss, and I don't know when they stopped working- does anyone have any idea what's going on...?
_________________
This signature is brought to you by procrastination! It's a re... bleh.
Back to top View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Mon Aug 02, 2004 10:44 am    Post subject: Re: Headers sent even in simplest script, yet work on xBlogL Reply with quote

The reason you are getting the header sent error is that something has been written to the page.
make sure that the header is at the top of the page before anything else

have you tried it without the "http://" or the last "/" ?
_________________
Anthony R

Roganty
| Links-Links.co.uk
Back to top View user's profile Send private message Visit poster's website
aprelium-beta
-


Joined: 24 Jun 2004
Posts: 383

PostPosted: Mon Aug 02, 2004 11:36 pm    Post subject: Re: Headers sent even in simplest script, yet work on xBlogL Reply with quote

omega wrote:
Hello, all... on my local host, I'm having a very frustrating problem pertaining to header functions. First of all, the header() and setcookie() functions work fine on the copy of xBlogLite <http://www.infinitywebdesign.com/software/xbloglite/> which is running on my server, so I'm not sure if it IS a server problem. But despite that, in a script with something like "<?php header("Location: http://www.example.com/");?>" it gives the headers sent error, with the line number stated in the error ALWAYS being the line that the header function is on. I've also tried <?php ob_start(); header("Location: http://www.example.com/"); ob_flush(); ?>, but that made no difference. I remember headers worked when I first started with Abyss, and I don't know when they stopped working- does anyone have any idea what's going on...?

Abyss doesn't execute your PHP code. So the error you get has to do only with your code.
Any blank line before <?php header() ?> results in PHP send the headers. So remove anything before the <?php to have your headers work as expected. If the problem persists, send us your PHP file and we'll tell you how to fix it.
_________________
Beta Testing Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
omega
-


Joined: 26 Jun 2004
Posts: 10
Location: New England, MA

PostPosted: Tue Aug 03, 2004 3:39 am    Post subject: Reply with quote

I already said that all that was in the file was '<?php header('Location: http://www.google.com/'); ?>, Aprelium-beta. And the reason I asked here was because someone might've had a similair problem. But, nevermind, because I've found a solution- not an answer, but a solution, so good enough for me. When I save the file with notepad, I have to select ANSI instead of UTF-8, and for some reason it then works. *Shrugs* BTW, thanks for your reply Roganty...

Ah, yes, and all of the xBlogLite files were saves as ANSI, apparently, so that at least explains why it worked there, but not for me... :)
_________________
This signature is brought to you by procrastination! It's a re... bleh.
Back to top View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
aprelium-beta
-


Joined: 24 Jun 2004
Posts: 383

PostPosted: Tue Aug 03, 2004 9:41 pm    Post subject: Reply with quote

omega,

PHP only undestands ISO-8859-1 encoding (which is almost the same as ANSI.) Any other encoding (including UTF-8) can cause problems.
_________________
Beta Testing Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
omega
-


Joined: 26 Jun 2004
Posts: 10
Location: New England, MA

PostPosted: Wed Aug 04, 2004 6:23 pm    Post subject: Reply with quote

Oh, really? I've never heard that... but I'll take that into mind from now on. Thanks for the tip.
_________________
This signature is brought to you by procrastination! It's a re... bleh.
Back to top View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group