Forum Moderators: coopster

Message Too Old, No Replies

Host doesn't support sessions. What can I do?

Host doesn't support sessions. What can I do?

         

matthewamzn

1:23 am on Feb 6, 2005 (gmt 0)

10+ Year Member



I'm just starting to learn php. I bought a site search tool (site search pro), and can't install it because my web host doesn't automatically support php sessions. They said to paste the code below into the pages that require sessions. I tried just pasting it into the php pages, but that didn't work. Is this a generic code, and do I need to adjust it? I'm not sure if I should replace your_homedir with something else.

session_save_path("/home/users/web/<bucket>/<your_homedir>/cgi-bin/tmp");
session_start();

matthewamzn

2:27 am on Feb 6, 2005 (gmt 0)

10+ Year Member



if anyone else is having this problem. i found out you have to replace the bucket and you_homedir. to figure out these values i created a php page with the following code

<?php phpinfo();?>

coopster

1:11 pm on Feb 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, matthewamzn.

What your host is telling you is that you need to use your own tmp directory for storing session files. You see, when you start a session in PHP it will write a file on the server-side with a session id that matches the session id that the client (user's browser) will have. The session id is a hash value that gets transferred back and forth across the web rather than the values stored in the session, they get stored in the file in the tmp directory.

I'm not sure what the <bucket> is in this scenario, but you are probably looking for the DOCUMENT_ROOT environment variable. That will show you your path. Append the '/cgi-bin/tmp' to the end of that and you should be in business, assuming there is indeed a /tmp directory in your cgi-bin directory that is.