Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6551 > unrolled thread

PHP Always Outputs

Started byRyan <rbilesky@gmail.com>
First post2012-07-13 21:21 -0700
Last post2012-07-16 14:20 +0200
Articles 7 on this page of 27 — 11 participants

Back to article view | Back to comp.lang.php


Contents

  PHP Always Outputs Ryan <rbilesky@gmail.com> - 2012-07-13 21:21 -0700
    Re: PHP Always Outputs Luuk <luuk@invalid.lan> - 2012-07-14 10:54 +0200
      Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 09:19 -0400
        Re: PHP Always Outputs Luuk <luuk@invalid.lan> - 2012-07-14 16:21 +0200
          Re: PHP Always Outputs Luuk <luuk@invalid.lan> - 2012-07-14 16:51 +0200
            Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 15:46 -0400
    Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 09:17 -0400
    Re: PHP Always Outputs Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-07-14 13:37 +0000
      Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 09:46 -0400
        Re: PHP Always Outputs Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-07-14 14:40 +0000
          Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 15:00 -0400
            Re: PHP Always Outputs Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-07-14 20:12 +0000
              Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 16:16 -0400
                Re: PHP Always Outputs Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-07-15 00:59 +0000
                  Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-14 21:49 -0400
                    Re: PHP Always Outputs Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-07-15 16:14 +0000
                      Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-15 14:15 -0400
                      Re: PHP Always Outputs Michael Vilain <vilain@NOspamcop.net> - 2012-07-16 16:48 -0700
                        Re: PHP Always Outputs Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-16 20:30 -0400
                        Re: PHP Always Outputs The Natural Philosopher <tnp@invalid.invalid> - 2012-07-17 09:12 +0100
    Re: PHP Always Outputs "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-16 11:52 +0200
      Re: PHP Always Outputs Tim Streater <timstreater@greenbee.net> - 2012-07-16 19:18 +0100
        Re: PHP Always Outputs "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-17 09:30 +0200
          Re: PHP Always Outputs Tim Streater <timstreater@greenbee.net> - 2012-07-17 09:49 +0100
            Re: PHP Always Outputs "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-07-17 11:03 +0200
              Re: PHP Always Outputs "Peter H. Coffin" <hellsop@ninehells.com> - 2012-07-17 09:58 -0500
    Re: PHP Always Outputs Arno Welzel <usenet@arnowelzel.de> - 2012-07-16 14:20 +0200

Page 2 of 2 — ← Prev page 1 [2]


#6584

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-07-16 11:52 +0200
Message-ID<ju0o9o$6dt$1@dont-email.me>
In reply to#6551
El 14/07/2012 6:21, Ryan escribió/wrote:
> I want a php script to run and simply output nothing.  But even this script:
>
> <?php
> ?>
>
> will output this html
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
> <BODY></BODY></HTML>
>
> Is there a setting somewhere in my php or apache config that needs to be turned off?

Apparently, you are inspecting the output through a web browser and your 
browser has reached the conclusion that you are loading an HTML 
document. Since your (empty) code is not valid HTML, the browser does 
what it's been designed to do: fix it. In this case, it adds a few tags 
to obtain a valid empty HTML document.

The PHP way to make sure your output is not handled as HTML is to send 
an appropriate HTTP header, e.g.:

header('Content-Type: text/plain');

Additionally, you can remove the trailing "?>" closing tag, which is not 
mandatory and might lead to white space being sent to the browser.

The use of uppercase tags and Win-1252 encoding suggests we are talking 
about Internet Explorer. This browser is known for ignoring the 
Content-Type under certain circumstances. But of course that's another 
story.

-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#6594

FromTim Streater <timstreater@greenbee.net>
Date2012-07-16 19:18 +0100
Message-ID<timstreater-A46A62.19181816072012@news.individual.net>
In reply to#6584
In article <ju0o9o$6dt$1@dont-email.me>,
 "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> wrote:

> El 14/07/2012 6:21, Ryan escribió/wrote:
> > I want a php script to run and simply output nothing.  But even this 
> > script:
> >
> > <?php
> > ?>
> >
> > will output this html
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <META content="text/html; charset=windows-1252" 
> > http-equiv=Content-Type></HEAD>
> > <BODY></BODY></HTML>
> >
> > Is there a setting somewhere in my php or apache config that needs to be 
> > turned off?
> 
> Apparently, you are inspecting the output through a web browser and your 
> browser has reached the conclusion that you are loading an HTML 
> document. Since your (empty) code is not valid HTML, the browser does 
> what it's been designed to do: fix it. In this case, it adds a few tags 
> to obtain a valid empty HTML document.
> 
> The PHP way to make sure your output is not handled as HTML is to send 
> an appropriate HTTP header, e.g.:
> 
> header('Content-Type: text/plain');

header ('Content-Type: text/plain; charset=utf-8');

is better.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#6604

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-07-17 09:30 +0200
Message-ID<ju34au$aem$1@dont-email.me>
In reply to#6594
El 16/07/2012 20:18, Tim Streater escribió/wrote:
>> header('Content-Type: text/plain');
>
> header ('Content-Type: text/plain; charset=utf-8');
>
> is better.

To display an empty file?


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#6610

FromTim Streater <timstreater@greenbee.net>
Date2012-07-17 09:49 +0100
Message-ID<timstreater-E05B68.09490317072012@news.individual.net>
In reply to#6604
In article <ju34au$aem$1@dont-email.me>,
 "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> wrote:

> El 16/07/2012 20:18, Tim Streater escribió/wrote:
> >> header('Content-Type: text/plain');
> >
> > header ('Content-Type: text/plain; charset=utf-8');
> >
> > is better.
> 
> To display an empty file?

I can do *that* by opening a new document in TextWrangler. But if I want 
to do something useful using SQLite, PHP, ajax, JavaScript, CSS, and 
HTML, I eventually figured out that using utf-8 throughout made my life 
a lot easier. Especially as I can convert any junk I receive *into* 
utf-8, using PHP tools.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#6611

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-07-17 11:03 +0200
Message-ID<a6ko33F4boU1@mid.uni-berlin.de>
In reply to#6610
Am 17.07.2012 10:49, schrieb Tim Streater:
> In article <ju34au$aem$1@dont-email.me>,
> "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> wrote:
> 
>> El 16/07/2012 20:18, Tim Streater escribió/wrote:
>> >> header('Content-Type: text/plain');
>> >
>> > header ('Content-Type: text/plain; charset=utf-8');
>> >
>> > is better.
>>
>> To display an empty file?
> 
> I can do *that* by opening a new document in TextWrangler. But if I want to do
> something useful using SQLite, PHP, ajax, JavaScript, CSS, and HTML, I eventually
> figured out that using utf-8 throughout made my life a lot easier. Especially as I
> can convert any junk I receive *into* utf-8, using PHP tools.
> 


Of course AGV is making fun of the charset for an empty file, but apart from that I
wish the use of utf-8 were generally accepted. I just don't understand why there is
still so much iso-8859 in use, this charset is so limited.

/Str.

[toc] | [prev] | [next] | [standalone]


#6622

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2012-07-17 09:58 -0500
Message-ID<slrnk0avbv.h39.hellsop@nibelheim.ninehells.com>
In reply to#6611
On Tue, 17 Jul 2012 11:03:31 +0200, M. Strobel wrote:

> Am 17.07.2012 10:49, schrieb Tim Streater:
>
>> In article <ju34au$aem$1@dont-email.me>, "??lvaro G. Vicario"
>> <alvaro.NOSPAMTHANX@demogracia.com.invalid> wrote:
>>
>>> El 16/07/2012 20:18, Tim Streater escribi??/wrote:
>>>
>>> >> header('Content-Type: text/plain');
>>> >
>>> > header ('Content-Type: text/plain; charset=utf-8');
>>> >
>>> > is better.
>>>
>>> To display an empty file?
>>
>> I can do *that* by opening a new document in TextWrangler. But if I
>> want to do something useful using SQLite, PHP, ajax, JavaScript, CSS,
>> and HTML, I eventually figured out that using utf-8 throughout made
>> my life a lot easier. Especially as I can convert any junk I receive
>> *into* utf-8, using PHP tools.
>
> Of course AGV is making fun of the charset for an empty file, but
> apart from that I wish the use of utf-8 were generally accepted. I
> just don't understand why there is still so much iso-8859 in use, this
> charset is so limited.

Inertia and lack of awareness.

-- 
_  o
 |/)

[toc] | [prev] | [next] | [standalone]


#6587

FromArno Welzel <usenet@arnowelzel.de>
Date2012-07-16 14:20 +0200
Message-ID<ju10tr$k58$1@dont-email.me>
In reply to#6551
Am 14.07.2012 06:21, schrieb Ryan:
> I want a php script to run and simply output nothing.  But even this script:
>
> <?php
> ?>
>
> will output this html
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
> <BODY></BODY></HTML>

It may be your client which automatically creates this for "empty" 
documents. Did you verify this using wget or similar?

As you can see here - <http://arnowelzel.de/samples/empty.php> - this 
script does not produce any output.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.php


csiph-web