Through this post and this post,php 5.4 in my centos7 server is Cookies OFF
.
Test script as below:
<?php
if (isset($_GET['cookiecheck'])) {
if (isset($_COOKIE['testcookie'])) {
print "Cookies ON";
} else {
print "Cookies OFF";
}
} else {
setcookie('testcookie', "testvalue");
die(header("Location: " . $_SERVER['PHP_SELF'] . "?cookiecheck=1"));
}
?>
Then,I began to looking for reason(no any apache error log,just cannot use cookie).
phpinfo()
result seemed no problem:
In session.save_path
, /var/lib/php/session
,I can find some fresh files:
-rw------- 1 apache apache 7 Jan 21 10:34 sess_1bigb6qbcj3n09430h4ds6od02
-rw------- 1 apache apache 7 Jan 21 10:22 sess_407mq9gfd50jg4qeo6jededej3
-rw------- 1 apache apache 7 Jan 21 10:27 sess_5fg4og04vrqdbda3080mrnm9o3
-rw------- 1 apache apache 7 Jan 21 10:22 sess_6pnsa9ico2cppnl0ttbv83acn5
-rw------- 1 apache apache 7 Jan 21 10:24 sess_8gn7v82gf5cnhgvtmi8p01hb81
-rw------- 1 apache apache 7 Jan 21 10:22 sess_dbfa93el78h8s7m4f5hvojj0b4
-rw------- 1 apache apache 7 Jan 21 10:22 sess_i0r2k5ufb1eg2s205v1s3h62b5
-rw------- 1 apache apache 7 Jan 21 10:23 sess_kt5hpehhtvgqgncr72vllrtel4
Which means cookie saved in correct path when I run the test script.But I still get Cookies OFF
result.
when I vi sess_1bigb6qbcj3n09430h4ds6od02
,the content is only page|N;
.
Is that means nothing saved?Or something wrong happened?