Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unexpected absence of Expected warning

4 views
Skip to first unread message

Geevaa

unread,
Apr 24, 2007, 12:14:56 AM4/24/07
to
Hi Group,
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php


function Intelli()
{
echo"Hello P";
}
function Bitz()
{
echo"Hello MySQL";
}
;
$a = 1;
if($a)
$myFunc = 'Intelli';
else
$myFunc ='Bitz';


$myFunc();
print'header';

session_start();
setcookie('userid')
?>

----------------------------------------------------------------
The following is the output i got.
There is no warning


[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

Hello Pheader
-------------------------------------------------------------


can any one explain why i din get the warning.....

Martin Mandl - m2m tech support

unread,
Apr 24, 2007, 2:57:56 AM4/24/07
to
On Apr 24, 6:14 am, Geevaa <govivasa...@gmail.com> wrote:
> The page 167 of book Learning PHP5 by David Sklar says that
> setcookie() and session_start() must be added before any output.
> I tried to use that functions at last line but no warning!.
> The warning which i got 1 month back is not issued now.

Dear Geevaa,

the book is right ;) However, php does not send the output bit by bit.
It waits till a "reasonable" amount of data has accumulated and
flushes then the output ...
In your case you send only a couple of bytes, which are still in the
buffer when you start the session. Therefore you get no error message.
Try to send more text (much more).

Cheers
Martin

------------------------------------------------
online accounting on bash bases
Online Einnahmen-Ausgaben-Rechnung
http://www.ea-geier.at
------------------------------------------------
m2m server software gmbh
http://www.m2m.at

Geevaa

unread,
Apr 24, 2007, 3:36:00 AM4/24/07
to
Dear martin,

I tried with more text but still I am not receiving any
warning.... please explain why i am not receiving any warning...
---------------------------------------------------------------------
I changed the program as follows...

<?php


function Intelli()
{
echo"Hello P";
}
function Bitz()
{
echo"Hello MySQL";
}
;
$a = 1;
if($a)
$myFunc = 'Intelli';
else
$myFunc ='Bitz';


$myFunc();
print'header';
print<<<_HTML_

IntelliBitz Home

OpenSource Development, Consulting and Training in Chennai. Ajax,
Enterprise JAVA, PHP, Ruby on Rails, Perl, BPEL, ESB, MYSQL are some
of the technologies that we specialize in. We use leading frameworks
like Seam, Spring, Hibernate to get things done fast. We have a bias
towards free opensource software but we service our customers based on
their needs and not on our likes.


All members are encouraged to post new topics. All members are
encouraged to respond to existing topics. All members are encouraged
to share their technical experience for the benefit of the community.
Knowledge is power and the only way we get it is by asking questions.

For real world hands on development training, please call 044 - 2247
5106 or send an email to trai...@intellibitz.com.

Please visit http://www.intellibitz.com for more details.
_HTML_;

session_start();
setcookie('userid')
?>

-------------------------------------------------------------------------
I got the output with out warning


[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/

Set-Cookie: PHPSESSID=j2djpja0mt52bcobvcibf9r7j6; path=/


Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

Hello Pheader
IntelliBitz Home

OpenSource Development, Consulting and Training in Chennai. Ajax,
Enterprise JAVA, PHP, Ruby on Rails, Perl, BPEL, ESB, MYSQL are some
of the technologies that we specialize in. We use leading frameworks
like Seam, Spring, Hibernate to get things done fast. We have a bias
towards free opensource software but we service our customers based on
their needs and not on our likes.


All members are encouraged to post new topics. All members are
encouraged to respond to existing topics. All members are encouraged
to share their technical experience for the benefit of the community.
Knowledge is power and the only way we get it is by asking questions.

For real world hands on development training, please call 044 - 2247
5106 or send an email to trai...@intellibitz.com.

Please visit http://www.intellibitz.com for more details.

Martin Mandl - m2m tech support

unread,
Apr 25, 2007, 8:00:35 AM4/25/07
to
On Apr 24, 9:36 am, Geevaa <govivasa...@gmail.com> wrote:
> Dear martin,
>
> I tried with more text but still I am not receiving any
> warning.... please explain why i am not receiving any warning...
> ---------------------------------------------------------------------
> I changed the program as follows...

Dear Geevaa,

it depends on your settings. My test server gives the warning even for
a couple of bytes. However, if I enable compression, e.g. putting
"php_flag zlib.output_compression on" into an .htaccess file the error
disappears. Because then, the server is buffering everything ... Have
a look if you are using output compression!

Geevaa

unread,
Apr 27, 2007, 3:27:58 AM4/27/07
to
Dear Martin,

is that warning may be in the log file?
is this engine may be related to zend engine?
two months back i was receiving that warning but unfortunately i am
forced to reinstall php .
is this issue is related to improper installing of php.

thanks

Martin Mandl - m2m tech support

unread,
Apr 27, 2007, 5:38:45 AM4/27/07
to

What does phpinfo() say about output compression?

Geevaa

unread,
Apr 30, 2007, 6:26:02 AM4/30/07
to
On Apr 27, 2:38 pm, Martin Mandl - m2m tech support


martin...@gmail.com

Geevaa

unread,
Apr 30, 2007, 6:33:21 AM4/30/07
to
Dear Martin,


Directive Local Value Master Value
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value


This is what my phpinfo() says.


Thanks.

0 new messages