Forum Moderators: coopster

Message Too Old, No Replies

session_start() problem

         

Slait

4:16 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



Hi All,
Could anybody give me a hint? I'm running PHP4.3.4 and trying
to use sessions. But the following starting point
<?php
session_start();
?>
brings such a message:

The following error was encountered:
* Zero Sized Reply
Squid did not receive any data for this request.

jatar_k

5:14 pm on Aug 10, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



squid never likes zero sized pages, this doesn't mean anything is wrong it is just telling you the page had nothing in it

try adding a little content

<?php
session_start();
$SESSION['mytestvar'] = 'php rocks';
echo 'did you know that: ', $SESSION['mytestvar'];
?>

should be a fine test

Slait

5:28 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



No that doens't help much :(
I also tried to use other session fuctions as session_id or
session_unset(); and no errors observed, but with session_start() I got this error and it looks very strange for me. By the way setcookie() also works. So as it seems for me I can get the same functionality of the script using cookies without session functions? Or there is real difference in using session and cookies without session?
Thank you

coopster

2:51 am on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, Slait.

That all depends on how your server is configured for PHP sessions [php.net]. You may also want to consider upgrading that server if you can. You are a few (security) releases behind.

FiRe

8:28 am on Aug 12, 2005 (gmt 0)

10+ Year Member



try jatar's test again with the correct code...

<?php
session_start();
$_SESSION['mytestvar'] = 'php rocks';
echo 'did you know that: ' . $_SESSION['mytestvar'];
?>

;-)

coopster

1:03 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If you were referring to the syntax of the echo [php.net] language construct, FiRe, you better read again. There is nothing wrong with that statement ;)


// Some people prefer passing multiple parameters to echo over concatenation. 
echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10);
echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n";

FiRe

2:14 pm on Aug 12, 2005 (gmt 0)

10+ Year Member



i was talking about the missing _ in SESSION!

jatar_k

3:22 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hehe, underscores help ;)

but to be honest it shouldn't have changed anything there should have been output as I made the mistake in both vars

coopster

2:19 am on Aug 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




i was talking about the missing _ in SESSION!

Ah yes, you should have been more specific ;)