.htaccess to enable sessions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to get this blasted .htaccess file sorted out, so I can have
sessions without register_globals being on.

I have looked everywhere for info on this and I mean everywhere
including the php.net manual.

In the manual it said to include something like the following:

php_flag register_globals off;
php_value session.save_path C:\home\user\siteroot\sess\users
php_value session.cookie_time 3600
php_value session.gc_maxlifetime 3600
php_value include_path .;C:\home\user\siteroot\sess
php_value auto_prepend C:\home\user\siteroot\sess\path_file.php

I did that and then someone in here said that it was wrong and I
needed to include all these other things and have other files in
different places as well.

To start with, I was informed in this group that all I needed was a
..htaccess file nothing else.

I am running locally, I have Windows XP Pro. I have Apache 2.0.49, PHP

What exactly do I need to have in this .htaccess file (and elsewhere)
to get sessions to work?  What am I doing wrong?  All I have done is
followed what people in here and the advice in the manual said.

Is asp or coldfusion as complicated and troublesome to use as php is?

Are there any "good php" books that have recently been published that
explain clearly how to enable sessions without register_blobals being
on?  This book I am working through is pretty new, it is for learning
asp, coldfusion or php with mysql in dreamweaver mx 2004!  It has only
recently been published but is still going with the old method of
globals being on!  I have four other books on php as well, and none of
them deal with this.

Help please before I pull all my hair out! (whats left of it!)


Re: .htaccess to enable sessions

Quoted text here. Click to load it

Most default PHP installs I see have sessions enabled already. What does
phpinfo() say when you don't have any .htaccess file in place? What evidence
do you have that sessions are not working? You haven't shown any code where
you attempt to use sessions, so it may well be that you simply aren't coding
correctly and your configurations are correct.

Show a short and complete example that demonstrates the problem, describe
the symptoms, and perhaps we can help you retain a few hairs.

As pointed out by Bob the primary key is to use $_SESSION array to access
session variables. That, and issue a session_start() function call at the
beginning of your script.

 - Virgil

Site Timeline