You are here: Re: ini_set() not working as expected « PHP Programming Language « IT news, forums, messages
Re: ini_set() not working as expected

Posted by Kimmo Laine on 06/08/06 09:11

"yawnmoth" <terra1024@yahoo.com> wrote in message
news:1149751294.421301.16080@j55g2000cwa.googlegroups.com...
>
> Paul Lautman wrote:
>> yawnmoth wrote:
>> <snip>
>> The headers are sent as soon as some output is sent. In your case you are
>> sending a blank followed by the text random text, before doing the
>> session_start().
> Why isn't the ini_set preventing that, though? I don't want PHP to
> propogate PHPSESSID via $_COOKIE - I want it to propogate through
> $_GET.
>
> I could just do it via .htaccess or php.ini, but doing so would still
> leave me wondering why ini_set doesn't work. As far as I know, it
> should, yet it doesn't, and I'd like to know why.


Ini_set doesn't work that way because it's never meant to work that way in
the first place. It doesn't affect the way headers and body are sent. once
you start sending the body, session information cannot be sent, headers were
already sent. When you close the first php tag, the random text is echoed
out to client. That's when headers are sent and sending body begins.

After ini_set you might want to call ob_start() if you want the output to be
buffered. Then you should be able to set session variables later because
output doesn't begin until ob_flush() is called or page ends.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация