I know that the question is bayan, but still. I write in php.ini:

suhosin.session.cryptua = Off suhosin.session.cryptdocroot = Off session.cookie_domain = ".example.ru" session.save_path = "/var/www/user/data/bin-tmp" 

but the session created on code.example.ru does not match the session on example.ru/admin

What to do?

UPD: code with code.example.ru:

 <? session_start(); if(isset($_GET['logout'])){ session_unset(); session_destroy(); }else{ $_SESSION['test'] = "ok"; } print_r($_SESSION); ?> 

code from example.ru:

 print_r($_SESSION); die(); 

output c code.ex ...:

 Array ( [test] => ok ) 

output from exampl ...:

 Array ( ) 

    2 answers 2

    In php.ini, if these lines do not already exist:

     suhosin.cookie.cryptdocroot = Off 

    Source: https://bugs.php.net/bug.php?id=43682

    • IMPORTANT to use php.ini - Arc
    • @Arc, is it? - etki
    • Yes, in this problem, yes. - Arc
    • Sorry, did not see this condition. Corrected the answer. - VenZell
    • Nothing changed. The point is to change nothing in the scripts ... - Arc

    Is it possible to do it through .htaccess like this :?

     php_value session.cookie_domain .site.ru 

    upd. Checked it works for me. Although your code is also correct.

    • necessary via php.ini. By the way, with such a record it gives an error - Arc