session_start();

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
npodges
Forum Newbie
Posts: 12
Joined: Tue Aug 12, 2003 5:55 pm

session_start();

Post by npodges »

i'm having problems using session_start(). ultimately, i want to make a login session, but even using simpler code from the php documentation, i get errors.

Code: Select all

<?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION&#1111;'favcolor'] = 'green';
$_SESSION&#1111;'animal']  = 'cat';
$_SESSION&#1111;'time']    = time();

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
http://68.41.89.22/retard.php <- the page with errors
http://68.41.89.22/test.php <- my phpinfo()
thanks.
-nick podges
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

You need to set the php.ini file to
session.save_path = C:\PHP\sessiondata

instead of
/tmp
npodges
Forum Newbie
Posts: 12
Joined: Tue Aug 12, 2003 5:55 pm

hmm

Post by npodges »

well, i've got php installed into c:/php-4.3.4-Win32.
there's no sessiondata folder there. should there be?
-nick podges
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

actually you can name it whatever you want, but make sure if it's not there, create it.
You might also have to restart your web server (not sure)
Post Reply