Gossamer Forum
Home : General : Internet Technologies :

PHP Sessions

Quote Reply
PHP Sessions
PHP Version 4.0.5 [Linux/Apache]
register_globals disabled

file1.php contains
====================
session_start();
$HTTP_SESSION_VARS["variable"] = "some value";

file1.php outputs HTML form which POSTs to file2.php

file2.php contains
====================
session_start();

...however, $HTTP_SESSION_VARS["variable"] is not undefined.

Appears to be related to the fact that register_globals are turned off. On other servers (where register_globals enabled), it is defined. BTW, not using $_SESSIONS to ensure portablity for versions of PHP before 4.1. Any PHP programmers have any clues as to how to preserve the session from one PHP to another when register_globals are disabled (now disabled by default in newer versions of PHP for security reasons)? And no, variable cannot be passed as form hidden input field - must be passed using PHP session.

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] PHP Sessions In reply to
I think I might see the problem - track_vars is not enabled in the PHP config. However, this person does not have root access, and their web host is unable to reconfigure PHP. Is there a work-around I ask myself.

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] PHP Sessions In reply to
I have no idea if this will work or not, but you might try seeing if you can change those settings on a page-by-page basis using ini_set:

http://www.php.net/...function.ini-set.php

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [dan] PHP Sessions In reply to
This is why I prefer perl over php. I hate the idea of having to play with config files before my script will work.
Quote Reply
Re: [hennagaijin] PHP Sessions In reply to
Thanks, much appreciated - that's what I was looking for! I already had added one line to the .htaccess file in the directory that the PHP files are located, and that resolved many of the issues. But I had to still revise two of the PHP files for a full fix. Works now. But (using the URL you provided for reference) I'll see if I can tinkle with the .htaccess some more to see if I can get the stock PHP files to run as is - would make life alot easier when it comes to upgrades.

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [Paul] PHP Sessions In reply to
PHP is pretty easy to configure, and you can do quite a bit per directory via .htaccess. However, this is very rare. Only time I've run into problems - one out of 100's is not too bad. The server in question is pretty messed up in terms of PHP config and config in general. But they do have SFTP installed =)

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln