Re: Session configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David,

I too had the same problem, once I put the session_start(); outside the HTML
<html> tag it's now gone away, but, using this code which is in a tutorial,
I get these errors:
++++++++++++++++Start Code ++++++++++++++++++++++++++++++
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<title>Session test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
print($counter);
$counter++;
session_register("counter");

?>


</body>
</html>

++++++++++++++++Start Error ++++++++++++++++++++++++++++++
Parse error: parse error, unexpected ';' in
c:\inetpub\wwwroot\php\session.php on line 13

Any suggestions?  I'm my WindowsXP Pro machine, and I'm from a ColdFusion
background so this is all similar but different to me.

Col



"David Felton" <davidfelton@codemasters.com> wrote in message
EC8809603B906D40BDBC0849F4882C65476C31@pat.codemasters.local">news:EC8809603B906D40BDBC0849F4882C65476C31@pat.codemasters.local...
> The error just means you are printing something out before you call
> session_start();
>
> you just need to call session_start() *before* you print anything out to
the
> page, so it's best off called at the top/start of your php page.
>
> -----Original Message-----
> From: Voodoo [mailto:cronopio@terra.com.br]
> Sent: 10 November 2003 5:09
> To: php-windows@lists.php.net
> Subject:  Session configuration
>
>
> I'm using php 4.3.0 under an IIS server, and I'm having some trouble on
> starting a session. I guess it's a configuration problem. Tried to edit
the
> php.ini file, and found this line:
>
> ; Handler used to store/retrieve data.
> session.save_handler = files
>
> ; Argument passed to save_handler.  In the case of files, this is the path
> ; where data files are stored. Note: Windows users have to change this
> ; variable in order to use PHP's session functions.
>
> I don't know what changes I got to do, as Windows user, to get it working
> properly. Is this the problem?
>
> The session.save_path is allright, I can see the session file being
created
> every time I use the session_start() method, but I receive this error
> message:
>
> Warning: session_start() [function.session-start]: Cannot send session
> cookie - headers already sent by (output started at c:\(blah)\teste.php:9)
> in c:\(blah)\teste.php on line 12
>
> Warning: session_start() [function.session-start]: Cannot send session
cache
> limiter - headers already sent (output started at c:\(blah)\teste.php:9)
in
> c:\(blah)\teste.php on line 12
>
> The script I'm using to test it is the session example script from the
> documentation at php.net:
>
> session_start();
> if (isset($HTTP_SESSION_VARS['count'])) {
>    $HTTP_SESSION_VARS['count']++;
> }else {
>    $HTTP_SESSION_VARS['count'] = 0;
> }
> echo $HTTP_SESSION_VARS['count']."<br>";
> ?>
> <a href="teste.php">Acrescentar</a>
>
> Can somebody help me?
>
> Cheers,
>
> Voodoo
>
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> **********************************************************************

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux