Working with Sessions on WAMP
Posted by: denewey (---.hsd1.ma.comcast.net)
Date: April 01, 2008 11:44PM

I installed WAMP on my windows Vista and it has been working fine, except now I'm working on a project in which I tried to set up a session and it wouldn't do it. I've looked at the php.ini file and it looks like it has the right configuration for sessions, but when I use session_start() nothing happens. Any idea what I need to do to have sessions enabled?

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: yfastud (Moderator)
Date: April 02, 2008 12:37AM

Make sure codes for section should be before any other codes

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: denewey (---.hsd1.ma.comcast.net)
Date: April 02, 2008 11:10AM

Codes for the session are before any other code

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: h_a (168.187.86.---)
Date: April 02, 2008 12:09PM

if you're using http_session_vars[yourtexthere] this kind of code replace
it with just $_session[yourtexthere]

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: yfastud (Moderator)
Date: April 02, 2008 01:50PM

Forget to mention that you must use full tag <?php .... ?> if short_open_tag is not enable in php.ini

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: denewey (---.hsd1.ma.comcast.net)
Date: April 02, 2008 06:57PM

I don't have short tag enabled, so I am using the full tag.

Options: ReplyQuote
Re: Working with Sessions on WAMP
Posted by: yfastud (Moderator)
Date: April 03, 2008 12:47AM

Huh? Does it mean your script is running now? If not, try this simple script to make sure your session is working

<?php
session_start();  
if(isset($_SESSION['views']))
    $_SESSION['views'] = $_SESSION['views']+ 1;
else
    $_SESSION['views'] = 1;

echo "views = ". $_SESSION['views']; 
?>

Save as session.php in folder c:/wamp/www/test and run as

http:// localhost/test/session.php

Everytime you refresh your browser, the number must increase

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.