View previous topic :: View next topic |
Author |
Message |
omega -
Joined: 26 Jun 2004 Posts: 10 Location: New England, MA
|
Posted: Mon Aug 02, 2004 6:07 am Post subject: Headers sent even in simplest script, yet work on xBlogLite |
|
|
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 |
|
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Mon Aug 02, 2004 10:44 am Post subject: Re: Headers sent even in simplest script, yet work on xBlogL |
|
|
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 |
|
 |
aprelium-beta -
Joined: 24 Jun 2004 Posts: 383
|
Posted: Mon Aug 02, 2004 11:36 pm Post subject: Re: Headers sent even in simplest script, yet work on xBlogL |
|
|
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 |
|
 |
omega -
Joined: 26 Jun 2004 Posts: 10 Location: New England, MA
|
Posted: Tue Aug 03, 2004 3:39 am Post subject: |
|
|
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 |
|
 |
aprelium-beta -
Joined: 24 Jun 2004 Posts: 383
|
Posted: Tue Aug 03, 2004 9:41 pm Post subject: |
|
|
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 |
|
 |
omega -
Joined: 26 Jun 2004 Posts: 10 Location: New England, MA
|
Posted: Wed Aug 04, 2004 6:23 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|
|