cancel
Showing results for 
Search instead for 
Did you mean: 

php session cookie / file

N/A

php session cookie / file

Hi, I'm hoping someone can help.
I've got a working site on my home pc (windows), using php (with smarty) and mysql.
This is meant to be an ecommerce site, so I must be able to retain session information.
When I upload the php files to my cgi area on force9 the site displays, except that it appears as if the session values are not retained from one page to another. Checking the home installation I find that there is a directory under the PHP installation that contains session files. Is there a similar directory on the force9 cgi server, or do I need to create a directory under my cgi space, and if so how do I tell the force9 PHP server the location ?
I've tried to research the answer in the forums, but haven't found anything to help.
Thanks in advance.
5 REPLIES
N/A

php session cookie / file

Hi warmth,

I have many sites on the CGI server that use sessions (never really bothered to get my head around cookies Wink), and they worked without any additional setting up apart from what is needed in the code.

Perhaps the version on your home server is a newer version than is running on the CGI server? Not sure exactly how you have coded it but all I can suggest is that you make sure you have the session_start(); command before anything is output, and to save/access the session variables through the $_SESSION array...

Cant suggest any more than that I'm afraid!!

Jarv
N/A

php session cookie / file

Thanks, Jarvis.
My home version is 4.3.2.
I was originally using :
<?php
session_start();
$var1="text";
session_register('var1');

Now I'm using :
<?php
session_start();
$_SESSION["var1"]="text";

To me these should be synonymous.
In either case, on the following page, when I go :
<?php
session_start();
$testVar = false
if (isset($HTTP_SESSION_VARS['var1'])
{
$testVar = $HTTP_SESSION_VARS['var1'];
echo "The session variable var1 contains :";
echo $testVar;
}
When accessing the 2nd page without passing through the 1st page, nothing shows.
When accessing the 2nd page after the 1st page, the line "variable contains" displays, but the contents of the variable doesn't.
To me this shows that the session variable is created, but it's not taking in the content (or I'm not successfully retrieving the content).
As stated earlier - it works fully on my home setup, but not on the force9 hosted setup.
Rgds.
N/A

php session cookie / file

humm, thats weird, added your code into my webspace and it works fine:

http://www.djarv.co.uk/test1.php

(code used is displayed)
N/A

php session cookie / file

Thanks, Jarvis.

I've just tried your code in two new pages on my site, and it works.
Thus, the problem lies with my original pages rather than with sessions on force9.

I feel further debugging coming on.
:roll:
Best regards.
N/A

php session cookie / file

no worries, glad to help Smiley