php unseting $_SESSION variable on page referesh or redirected
I have moved our code to new server PHP version is 7.1 previously used were 5.6.
I am facing problems on $_SESSION variable. if page is redirected to other pages $_SESSION is have no values, even I reload this page again after commented session set as well $_SESSION values are gone.
ob_start(); session_start();
$_SESSION['abc'] = "manik";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
session_regenerate_id(true);
header('Location:test2.php');
exit();
session_save_path
Please advise.
php session session-variables
|
show 1 more comment
I have moved our code to new server PHP version is 7.1 previously used were 5.6.
I am facing problems on $_SESSION variable. if page is redirected to other pages $_SESSION is have no values, even I reload this page again after commented session set as well $_SESSION values are gone.
ob_start(); session_start();
$_SESSION['abc'] = "manik";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
session_regenerate_id(true);
header('Location:test2.php');
exit();
session_save_path
Please advise.
php session session-variables
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
Do you get any error ?
– Soheyl
Jan 2 at 11:53
|
show 1 more comment
I have moved our code to new server PHP version is 7.1 previously used were 5.6.
I am facing problems on $_SESSION variable. if page is redirected to other pages $_SESSION is have no values, even I reload this page again after commented session set as well $_SESSION values are gone.
ob_start(); session_start();
$_SESSION['abc'] = "manik";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
session_regenerate_id(true);
header('Location:test2.php');
exit();
session_save_path
Please advise.
php session session-variables
I have moved our code to new server PHP version is 7.1 previously used were 5.6.
I am facing problems on $_SESSION variable. if page is redirected to other pages $_SESSION is have no values, even I reload this page again after commented session set as well $_SESSION values are gone.
ob_start(); session_start();
$_SESSION['abc'] = "manik";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
session_regenerate_id(true);
header('Location:test2.php');
exit();
session_save_path
Please advise.
php session session-variables
php session session-variables
edited Jan 1 at 10:49
arvindpundir
asked Jan 1 at 10:28
arvindpundirarvindpundir
587
587
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
Do you get any error ?
– Soheyl
Jan 2 at 11:53
|
show 1 more comment
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
Do you get any error ?
– Soheyl
Jan 2 at 11:53
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
Do you get any error ?
– Soheyl
Jan 2 at 11:53
Do you get any error ?
– Soheyl
Jan 2 at 11:53
|
show 1 more comment
2 Answers
2
active
oldest
votes
you can check you session.save_path i THINK SO ITS NOT writable That's why ur facing this issue
if (!is_writable(session_save_path()))
{
echo 'Session path "'.session_save_path().'" is not writable for PHP!';
}
add a comment |
save your variables in an array first. Then, set session data using set_userdata method.
Example:
$session_data = array('abc' => 'manik');
Then,
$this->session->set_userdata($session_data);
Hope, this works
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994720%2fphp-unseting-session-variable-on-page-referesh-or-redirected%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
you can check you session.save_path i THINK SO ITS NOT writable That's why ur facing this issue
if (!is_writable(session_save_path()))
{
echo 'Session path "'.session_save_path().'" is not writable for PHP!';
}
add a comment |
you can check you session.save_path i THINK SO ITS NOT writable That's why ur facing this issue
if (!is_writable(session_save_path()))
{
echo 'Session path "'.session_save_path().'" is not writable for PHP!';
}
add a comment |
you can check you session.save_path i THINK SO ITS NOT writable That's why ur facing this issue
if (!is_writable(session_save_path()))
{
echo 'Session path "'.session_save_path().'" is not writable for PHP!';
}
you can check you session.save_path i THINK SO ITS NOT writable That's why ur facing this issue
if (!is_writable(session_save_path()))
{
echo 'Session path "'.session_save_path().'" is not writable for PHP!';
}
answered Feb 8 at 11:37
Manik khannaManik khanna
388
388
add a comment |
add a comment |
save your variables in an array first. Then, set session data using set_userdata method.
Example:
$session_data = array('abc' => 'manik');
Then,
$this->session->set_userdata($session_data);
Hope, this works
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
add a comment |
save your variables in an array first. Then, set session data using set_userdata method.
Example:
$session_data = array('abc' => 'manik');
Then,
$this->session->set_userdata($session_data);
Hope, this works
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
add a comment |
save your variables in an array first. Then, set session data using set_userdata method.
Example:
$session_data = array('abc' => 'manik');
Then,
$this->session->set_userdata($session_data);
Hope, this works
save your variables in an array first. Then, set session data using set_userdata method.
Example:
$session_data = array('abc' => 'manik');
Then,
$this->session->set_userdata($session_data);
Hope, this works
answered Jan 1 at 12:03
Rakib Ibna HamidRakib Ibna Hamid
345
345
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
add a comment |
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
its php project not the codeigniter one , thanks
– arvindpundir
Jan 2 at 4:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994720%2fphp-unseting-session-variable-on-page-referesh-or-redirected%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So you code was working in same browser using old PHP version ?
– Soheyl
Jan 1 at 11:52
yes when moved to new server its not working , i think its something session_save_path issue, local is saved there but master value not
– arvindpundir
Jan 1 at 12:47
So remove session_save_path from your script and test it with default tmp folder to see if it works :)
– Soheyl
Jan 1 at 13:17
no its not working with temp folder as well
– arvindpundir
Jan 2 at 4:06
Do you get any error ?
– Soheyl
Jan 2 at 11:53