FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » header() not being honored?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: header() not being honored? [message #174796 is a reply to message #174795] Sun, 10 July 2011 06:47 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Andre wrote:

> Le Fri, 08 Jul 2011 08:57:39 -0400, Billy Mays a écrit :
>> Am I misunderstanding how to use the header function? Is there another
>> way to see whats going on? Unfortunately, I'm in a shared hosting
>> environment, PHP: 4.4.9
>
> I alreay had the problem.
> If you attempt to print anything BEFORE the call to header, it skip.

True.

> But any blank line could cause the troube, I had once a blank line in a
> 'required file', something like:
>
> Debug = 1;

AFAIK this is not PHP code.

define('Debug', 1);

or

$Debug = 1;

would be.

> ?>
>
> The blank line between debug and ?> shoule also be removed.

Nonsense. Blank lines in the *generated* output matter, as the response
message body is considered to have started then. What is between `<?php'
and `?>' is not sent to the standard output as-is, but its parsing result
is. The parser ignores all whitespace unless it separates tokens or is
within a string literal (single-quoted, double-quoted, here-doc, or here-
string).

<http://www.php.net/manual/en/tutorial.firstpage.php>

> I still have trouble in a last script, so if someone has more on this..

You need to look *before* `<?php' and *after* `?>' for unwanted whitespace
and Byte Order Marks (BOMs), and *between* those delimiters for *statements*
that *generate* it (an empty line is not). For example, a common mistake is
to store a PHP script encoded in a UTF and attach a BOM (here for UTF-8,
where it is unnecessary and unwise anyway):

<EF><BB><BF><?php
header('...');
?>

A way to find out is

wget -O - http://example.example/index.php > /tmp/out.php
hexedit /tmp/out.php


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: about quality of SAP training videos
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 17:48:37 GMT 2024

Total time taken to generate the page: 0.03663 seconds