Jump to content

Recommended Posts

Hi,

My installation of php running with my Apache server does not seem to be handling session variables correctly.

Scripts run on a different server fine with session variables working and accessible as expected.

Is there a something I need to enable in the php.ini?

Any help would be appreciated, I can post the php info if necessary.

Thanks in advance,

Rob.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/
Share on other sites

[!--quoteo(post=362156:date=Apr 6 2006, 03:18 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 6 2006, 03:18 AM) [snapback]362156[/snapback][/div][div class=\'quotemain\'][!--quotec--]
sessions should work as soon as PHP is installed. How are you creating your sessions?
[/quote]

As follows:

<?

session_start();

$_SESSION["variable"]="Some data";

?>

As I said on another server they work fine used in this manner.

Rob.

Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24406
Share on other sites

So the above code you posted above works on your remote server but it doesnt work on your local server, which is installed on your PC?

If so does your local server have register_globals turned on, if it does turn it off? and does your local server have [b]short_open_tag[/b] turned on too as [b]short_open_tag[/b] (<?) is set to off by defualt.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24445
Share on other sites

Hi,

Thanks for the reply.

I checked the php.ini and register_globals was set to off. I have now checged it as follows, here is the cut and paste from my php.ini file:

; This file is different from the php.ini-dist file in the fact that it features
; different values for several directives, in order to improve performance, while
; possibly breaking compatibility with the standard out-of-the-box behavior of
; PHP 3. Please make sure you read what's different, and modify your scripts
; accordingly, if you decide to use this file instead.
;
; - register_globals = on [Security, Performance]
;

I closed Apache and restarted it but I still cannot access the session variables. I also checked that short_open_tag is switched on.

Any ideas?

Rob.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24597
Share on other sites

Turn register_globals off, I swear I didn't say turn it on. This is what I said:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]If so, does your local server have register_globals turned on? if it does turn it off.[/quote]


[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]; This file is different from the php.ini-dist file in the fact that it features
; different values for several directives, in order to improve performance, while
; possibly breaking compatibility with the standard out-of-the-box behavior of
; PHP 3. Please make sure you read what's different, and modify your scripts
; accordingly, if you decide to use this file instead.
;
; - register_globals = on [Security, Performance]
;[/quote]
Umm, Thats not the way to enable/disable register_globals. To enable/disable register_globals the option is around line 447 in the php.ini file.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24602
Share on other sites

[!--quoteo(post=362369:date=Apr 6 2006, 04:24 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 6 2006, 04:24 PM) [snapback]362369[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Turn register_globals off, I swear I didn't say turn it on. This is what I said:
Umm, Thats not the way to enable/disable register_globals. To enable/disable register_globals the option is around line 447 in the php.ini file.
[/quote]

Thanks yes I realised that after posting, I found the line that had no semi-colon in front of it, I think I was editing the comments of the ini file.

I am testing a few things but I am sure it is still not working.

Rob.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24608
Share on other sites

Hi,

I can confirm that around line 375 I am turning the globals on as follows:

register_globals = On

I have tried both on and off and my scripts do not work when accessing the session variables, 100% confirmed. Like I said same scripts on a differnet remote server work perfectly. This is very odd, any other ideas?

Thanks,

Rob.
Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-24617
Share on other sites

Hi,

I have register_globals turned off using the correct syntax but still no joy...... take a look at the two scripts which I am using to test, maybe there is a problem in my code?

First Script:

[b]<?

session_start();

$_SESSION['test']="ROB";

echo"<a href=test2.php>TRESTING</a>";

?>[/b]

Second Script:

[b]<?

session_start();

echo"$_SESSION['test']";

?>[/b]

The second script receives no data. I have a hammer in my hand and my server close by ;0)

Rob.

Link to comment
https://forums.phpfreaks.com/topic/6694-session-variables/#findComment-25044
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.