Problem using $ _SESSION in PHP 7.1.10

4

I have two servers running PHP, one in the 5.4.45 version and another 7.1.10 .

When running the files below in the same url, only the older version of PHP shows the values of the "Test" session. In the 7.1.10 version the Array is empty. Has anyone had this problem yet?

test1.php

session_start();

$_SESSION['nome'] = 'teste';

test2.php

session_start();

print_r($_SESSION);

// 7.1.10 
// Array();


// 5.4.45
// Array ( [nome] => gabriel );
    
asked by anonymous 24.10.2017 / 03:41

1 answer

1

There is a bug related to the xampp version, that is, x86 or x64 bits.

"I have a system with x64 bit windows and I installed a xampp with php7, but it was x86. This was one reason for this error, apache failed. Now I have separately installed apach2.4 (x64) and PHP7.0.1 which is working perfectly now. "

Other reports of the same error: link

Possible solution:

session.save_handler = files
session.save_path="C:\xampp\tmp"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies=0
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

A programmer said that there is an error in php.ini. link

    
24.10.2017 / 13:35