Knowledgebase
PHP using sessions
Posted by Gigaron, 12-24-2007, 02:49 AM | www.domain.com = Lighttpd + php-cgi
upload.domain.com = Apache + php
A user logs into www.domain.com and PHP creates a session. When the user follows a link to upload.domain.com it will think the user is not logged in and asks the user to re-logon again.
Both webservers and php are on the same server.
How can I resolve this?
Thanks.
|
Posted by dmspilot, 12-27-2007, 01:22 AM | Probably your cookie is being set for www.domain.com so the browser will not send it to upload.domain.com. Look at your cookies in Firefox to check. See the session.cookie_domain ini settings or pass the sessionid in the query string.
|
Posted by Jatinder, 12-27-2007, 03:42 AM | Step 1
Set session.cookie_domain to ".domain.com" in your php.ini or put the below line in your .htaccess file.
Step 2
Implement database backed session handler. That is, store session data in a database.
|
Posted by Gigaron, 12-27-2007, 03:43 AM | Thanks all. I got this working by creating a temporary cookie and a mysql db.
|
|
Add to Favourites
Print this Article |
Also Read