5

I have a strange error regarding the session name and session id.

I have used ini_set() to change session.name from PHPSESSID to 'AAA'

Also ini_set() is set before session_start()

Tired to use session_name() instead, same result

After I do that, the session_id() will return different id whenever I load the page. After I change back, work fine again.

May I have help to solve this?

Thank you very much!!

Update Solution:

Cannot change php session cookie name

Community
  • 1
  • 1
Micah
  • 4,254
  • 8
  • 30
  • 38
  • Why not use session_name() ( http://us3.php.net/session_name ) instead? Also, are you sure you changed the session name 'before' you start the session? – Jaap Moolenaar Nov 19 '13 at 09:41
  • @JaapMoolenaar, session_name() will have same result too. – Micah Nov 19 '13 at 09:44
  • 2
    I found the solution http://stackoverflow.com/questions/4005883/cannot-change-php-session-cookie-name – Micah Nov 19 '13 at 09:51
  • Alright ( it should ). How are your cookies setup? ( http://php.net/manual/en/function.session-set-cookie-params.php ) Are you perhaps changing domains between requests? http://stackoverflow.com/questions/5438335/php-session-losing-data-between-pages – Jaap Moolenaar Nov 19 '13 at 09:52
  • Ah, great! scratch my last comment. – Jaap Moolenaar Nov 19 '13 at 09:53

1 Answers1

1

Have you tried $mySession = session_name("AAA"); where $mySession is the current session?

ahmadsc
  • 41
  • 3