[mapserver-users] how to disappear Warning: session_start() in the page?

Peter webwiz at pl.net
Thu Aug 19 22:21:56 EDT 2010


Im not familiar with the code you are talking about, but i can tell you briefly when this errro occurs: an http response consists of two parts a header and the body. Attempts to write a http header when one has already been written and the body started will cause an error. A common cause of this (other than just plain writing a header in the wrong place) is that one of the libs in your package has stray whitespace in it, eg even a single space char after the closing ?> tag

Where to look in your case?

   "I:\ms4w\apps\appweb\htdocs\common\session\session.php on line 509 is
    trying to send a session control header."

Theres where the header is attempted.

   "headers already sent (output started at
    I:\ms4w\apps\appweb\htdocs\index_spatialphtml.phtml:6)"

Theres were the unexpected http body chars were found. Thats where id be looking.

If its not whitespace, then you need a programmer. Good luck.

Peter


elisabeth theresia wrote:
> *From:* elisabeth theresia <dbee_kawai at yahoo.com>
> *To:* mapserv forumlist <mapserver-users at lists.osgeo.org>
> *Sent:* Thu, August 19, 2010 9:04:43 AM
> *Subject:* Re: [mapserver-users] how to disappear Warning:
> session_start() in the page?
>
> Thanks Mr. Carlos,
>
> But, the session_start() already embedded by Chameleon Framework and
> also no HTML or PHP code before that.
>
> so how to fix it?
>
> Thanks
>
> -Elisabeth cheers from Indonesia :D too
>
> ------------------------------------------------------------------------
> *From:* Carlos Ruiz <boolean10001 at yahoo.com>
> *To:* elisabeth theresia <dbee_kawai at yahoo.com>;
> mapserver-users at lists.osgeo.org
> *Sent:* Thu, August 19, 2010 3:51:43 AM
> *Subject:* Re: [mapserver-users] how to disappear Warning:
> session_start() in the page?
>
> Elisabeth,
>
> It's quite as simple as the session handling. You can split your code
> into many files or keep it in one single file,
> the only thing you have to know is that PHP's session_start() function
> call must be the first thing wrote, no
> HTML or PHP code before that.
>
> Cheers from México
>
> IC Carlos Ruiz
>
> ------------------------------------------------------------------------
> *From:* elisabeth theresia <dbee_kawai at yahoo.com>
> *To:* mapserver-users at lists.osgeo.org
> *Sent:* Wed, August 18, 2010 2:48:58 PM
> *Subject:* Re: [mapserver-users] how to disappear Warning:
> session_start() in the page?
>
> Hello Mr. Sumariva, i already did wht u said, but there's new error:
> *error*: Call to undefined function: on_get_contens() in
> *I:\ms4w\apps\appweb\htdocs\index_cobacham.phtml* on line *2
>
> here i put the cobachanphtml.phtml:
> *<?php
> $html=on_get_contens();
> ob_end_clean();
>
> include("./chameleon.php");
> $szTemplate="./template_werror.html";
> $szMapFile="../map/kelur_cobacham.map";
> class SampleApp extends Chameleon //SampleApp merupakan turunan dari
> Chameleon
> {
> ......bla bla coding*
>
> So, what should i do?
> Thanks a lot for the attention, sorry reply not direct.
> *
>
> ------------------------------------------------------------------------
> *From:* Cristiano Sumariva <sumariva at gmail.com>
> *To:* elisabeth theresia <dbee_kawai at yahoo.com>
> *Sent:* Tue, August 17, 2010 12:34:39 AM
> *Subject:* Re: [mapserver-users] how to disappear Warning:
> session_start() in the page?
>
> Well, you can turn the things by other way.
> Put at top of HTML file in the ob_start() function to tell PHP to buffer
> all output.
> Change your your index_cobachan by adding
> $html = ob_get_contens();
> ob_end_clean();
>
> Now all the content that would be sent to browser is available at $html
> string variable.
> After the includes in your index_cobachan print the contents of $html var.
> Now do your application logic.
> THen append the rest of HTML file.
>
>
> Another option is to turn your HTML file into a template and add a
> special mark to signal template engine to replace some content but this
> would be another aproach.
>
> 2010/8/13 elisabeth theresia <dbee_kawai at yahoo.com
> <mailto:dbee_kawai at yahoo.com>>
>
>     Thanks Mr.Sumariva for the advice but, session_start() in the page
>     already embed in Chameleon framework at its folder in
>     \htdocs\common\session
>
>     the coding at line 509 (that shown error in the page):
>
>     //start the session
>     session_start();
>     register_shutdown_function( "session_write_close" );
>
>
>     // set IP if a new session
>     if ( $bNewSession ) $_SESSION["gszRemoteAdd"] = $_SERVER["REMOTE_ADDR"];
>
>     /*
>     ============================================================================
>     * Check IP to see if it is the same
>     *
>     =========================================================================
>     */
>
>     // check if the IP has been set and validate
>     if ( isset( $_SESSION["gszRemoteAdd"] ) &&
>     strlen(trim($_SESSION["gszRemoteAdd"])) > 0 )
>     {
>     // check if IP matches current client
>     if ( trim( $_SESSION["gszRemoteAdd"] ) !=
>     trim( $_SERVER["REMOTE_ADDR"] ) )
>     {
>     // possible security breach void session
>     /* if the session address is the loopback interface then it is
>     * likely that the application was configured to use an external
>     * address but someone is trying to test locally using localhost
>     */
>     if ($_SESSION['gszRemoteAdd'] != '127.0.0.1')
>     {
>     $bSessionOK = false;
>     }
>     }
>     }
>     else
>     {
>     // possible security breach void session
>     $bSessionOK = false;
>     }
>
>     // return success or failure and set global so we
>     // know session has been inited.
>     if ($bSessionOK)
>     {
>     $GLOBALS['session_started'] = true;
>     }
>
>
>     return $bSessionOK;
>
>     // end intializeSession() function
>     }
>
>     function getSessionSavePath()
>     {
>     $szReturn = ini_get("session.save_path")."/sess_".session_id()."/";
>     $szReturn = str_replace( "\\", "/", $szReturn );
>     return $szReturn;
>     }
>
>     Really need advice again Mr.
>     Thanks
>     ------------------------------------------------------------------------
>     *From:* Cristiano Sumariva <sumariva at gmail.com
>     <mailto:sumariva at gmail.com>>
>     *To:* elisabeth theresia <dbee_kawai at yahoo.com
>     <mailto:dbee_kawai at yahoo.com>>
>     *Sent:* Sat, August 14, 2010 8:57:29 AM
>     *Subject:* Re: [mapserver-users] how to disappear Warning:
>     session_start() in the page?
>
>     You should break your file in 2 files.
>     Put the session_start function at first and add it to the top of
>     your .phtml file.
>
>     The second file will contain all remaining code.
>
>     When using session in pages they have to be sent before any other thing.
>     This is a requirement in HTTP protocol.
>
>     2010/8/13 elisabeth theresia <dbee_kawai at yahoo.com
>     <mailto:dbee_kawai at yahoo.com>>
>
>         Hi all, i got message (for preview- i attached the page in
>         attachment-sessionerror2.jpg) :
>         *Warning*: session_start() [function.session-start
>         <http://localhost/appweb/function.session-start>]: Cannot send
>         session cache limiter - headers already sent (output started at
>         I:\ms4w\apps\appweb\htdocs\index_spatialphtml.phtml:6) in
>         *I:\ms4w\apps\appweb\htdocs\common\session\session.php**509* on
>         line
>
>         i have mapfile and template that already could show in the
>         initialize page named index_cobacham.phtml
>
>         Then my html + php = index_spatialphtml.phtml
>         i put <?php include ("index_cobacham.phtml")?> above the syntax
>         html.
>
>         So, what should i do?
>
>         Thanks :)
>
>
>         here the index_spatialphtml.phtml
>
>         http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>         <head>
>         <meta http-equiv="Content-Type" content="text/html; " />
>         <title>index</title>
>         <style type="text/css">
>         <!--
>         body {
>         font: 100% Verdana, Arial, Helvetica, sans-serif;
>         background: #666666;
>         margin: 0; /* it's good practice to zero the margin and padding
>         of the body element to account for differing browser defaults */
>         padding: 0;
>         text-align: center; /* this centers the container in IE 5*
>         browsers. The text is then set to the left aligned default in
>         the #container selector */
>         color: #000000;
>         background-image: url(./images/Background.gif);
>         }bla..bla coding
>
>
>     _______________________________________________
>     mapserver-users mailing list
>     mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list