PHP Sessions

This is a discussion on PHP Sessions within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi I'm having trouble getting sessions to work on my server. It's working on my univeristy account so ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-25-2004
victor
 
Posts: n/a
Default PHP Sessions

Hi

I'm having trouble getting sessions to work on my server.

It's working on my univeristy account so I assume that there is nothing
wrong with the code.

This is what my phpinfo(); is on my server
http://victor.is-a-geek.com/about/

This is what the phpinfo(); is on the university server
http://pages.cpsc.ucalgary.ca/~louiev/index.php

Any help would be good. I'm running PHP 4.3.4, Apache 1.3 and Redhat
9.0 on my server.

There some simple code on the top for a simple counter...pushing refresh
updates the number on the unversity server but not mine.

Thanks
Victor

Reply With Quote
  #2 (permalink)  
Old 01-26-2004
Michael Meckelein
 
Posts: n/a
Default Re: PHP Sessions

From: "victor"
> Hi
>
> I'm having trouble getting sessions to work on my server.
>
> It's working on my univeristy account so I assume that there is

nothing
> wrong with the code.
>
> This is what my phpinfo(); is on my server
> http://victor.is-a-geek.com/about/
>
> This is what the phpinfo(); is on the university server
> http://pages.cpsc.ucalgary.ca/~louiev/index.php
>
> Any help would be good. I'm running PHP 4.3.4, Apache 1.3 and

Redhat
> 9.0 on my server.


Dear victor,

what kind of error get you (use: error_reporting(E_ALL))?

Maybe not the session handling itself is the problem. I have noticed
that
you have on your server register_globals Off. On your uni server,
register_globals is On! Maybe this affect your script.

Keep in mind that register_globals off is recommend, and you should
not turn
it on!

Michael

Reply With Quote
  #3 (permalink)  
Old 01-27-2004
victor
 
Posts: n/a
Default Re: PHP Sessions

Michael Meckelein wrote:
> From: "victor"
>
>>Hi
>>
>>I'm having trouble getting sessions to work on my server.
>>
>>It's working on my univeristy account so I assume that there is

>
> nothing
>
>>wrong with the code.
>>
>>This is what my phpinfo(); is on my server
>> http://victor.is-a-geek.com/about/
>>
>>This is what the phpinfo(); is on the university server
>> http://pages.cpsc.ucalgary.ca/~louiev/index.php
>>
>>Any help would be good. I'm running PHP 4.3.4, Apache 1.3 and

>
> Redhat
>
>>9.0 on my server.

>
>
> Dear victor,
>
> what kind of error get you (use: error_reporting(E_ALL))?
>
> Maybe not the session handling itself is the problem. I have noticed
> that
> you have on your server register_globals Off. On your uni server,
> register_globals is On! Maybe this affect your script.
>
> Keep in mind that register_globals off is recommend, and you should
> not turn
> it on!
>
> Michael
>

Hi

It's not really an error...its just that sessions don't seem to be
working.

I figure it wasn't the code. This is the counter code up on the top:

<?php
session_start();
session_register('hits');
++$hits;
?>

<html>
<head><title>this is stupid</title></head>

<body>
<p> This page has been viewed <?= $hits; ?> times. </p>
</body>

</html>

Victor

Reply With Quote
  #4 (permalink)  
Old 01-27-2004
victor
 
Posts: n/a
Default Re: PHP Sessions

victor wrote:

> Hi
>
> I'm having trouble getting sessions to work on my server.
>
> It's working on my univeristy account so I assume that there is nothing
> wrong with the code.
>
> This is what my phpinfo(); is on my server
> http://victor.is-a-geek.com/about/
>
> This is what the phpinfo(); is on the university server
> http://pages.cpsc.ucalgary.ca/~louiev/index.php
>
> Any help would be good. I'm running PHP 4.3.4, Apache 1.3 and Redhat
> 9.0 on my server.
>
> There some simple code on the top for a simple counter...pushing refresh
> updates the number on the unversity server but not mine.
>
> Thanks
> Victor
>

Hi again,

I've installed PHP and Apache on another computer in my house and I get
this error now. It's installed on a Win XP machine.

Any idea on how to fix this one?

Any help is good...

Thanks
Victor


Reply With Quote
  #5 (permalink)  
Old 01-27-2004
victor
 
Posts: n/a
Default Re: PHP Sessions

victor wrote:

> victor wrote:
>
>> Hi
>>
>> I'm having trouble getting sessions to work on my server.
>>
>> It's working on my univeristy account so I assume that there is
>> nothing wrong with the code.
>>
>> This is what my phpinfo(); is on my server
>> http://victor.is-a-geek.com/about/
>>
>> This is what the phpinfo(); is on the university server
>> http://pages.cpsc.ucalgary.ca/~louiev/index.php
>>
>> Any help would be good. I'm running PHP 4.3.4, Apache 1.3 and Redhat
>> 9.0 on my server.
>>
>> There some simple code on the top for a simple counter...pushing
>> refresh updates the number on the unversity server but not mine.
>>
>> Thanks
>> Victor
>>

> Hi again,
>
> I've installed PHP and Apache on another computer in my house and I get
> this error now. It's installed on a Win XP machine.
>
> Any idea on how to fix this one?
>
> Any help is good...
>
> Thanks
> Victor
>
>

Sorry the error is this

Warning: session_start():
open(/tmp\sess_98ead586446f05cd8679b98d2671af2c, O_RDWR) failed: No such
file or directory (2) in E:\index.php on line 2

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at E:\index.php:2) in E:\index.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at E:\index.php:2) in E:\index.php on line 2


Thanks

Victor

Reply With Quote
  #6 (permalink)  
Old 01-27-2004
Tim Van Wassenhove
 
Posts: n/a
Default Re: PHP Sessions

On 2004-01-27, victor <vlouie21@hotmail.com> wrote:
> Warning: session_start():
> open(/tmp\sess_98ead586446f05cd8679b98d2671af2c, O_RDWR) failed: No such
> file or directory (2) in E:\index.php on line 2


Edit your php.ini file, and make session.save_path=c:/windows/tmp or
whatever folder you like. Afterwards you lookup why it is a good idea to
have a different session.save_path for each user (will be mentionned in
every document on php and security i guess)

--
http://home.mysth.be/~timvw
Reply With Quote
  #7 (permalink)  
Old 01-27-2004
Michael Meckelein
 
Posts: n/a
Default Re: PHP Sessions

"victor" wrote
> Warning: session_start(): Cannot send session cookie - headers already
> sent by (output started at E:\index.php:2) in E:\index.php on line 2


Be sure that you not send any other header (e.g. html tags ) befor you have
handled your sessions.

Michael

Reply With Quote
  #8 (permalink)  
Old 01-28-2004
Chris N
 
Posts: n/a
Default Re: PHP Sessions


"Michael Meckelein" <michael@go-on-line.de> wrote in message
news:bv5duo$odifd$1@ID-208606.news.uni-berlin.de...
> "victor" wrote
> > Warning: session_start(): Cannot send session cookie - headers already
> > sent by (output started at E:\index.php:2) in E:\index.php on line 2

>
> Be sure that you not send any other header (e.g. html tags ) befor you

have
> handled your sessions.
>
> Michael
>


You can also use buffering, and your HTTP Headers will get put at the top
for you when it does the output.

www.php.net/ob_start

Chris


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:24 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0