Page 1 of 1

Custom Session Handler Problem

Posted: Mon Jan 24, 2005 9:02 pm
by Andragon
Hi

I am using my own custom session handler on my server. This comes with a problem of changing each php file of Serendipity as you call session_start() in each script.

Might be an option to include a session.php where someone with a custom session handler can add code to.

Just a thought ;)

Re: Custom Session Handler Problem

Posted: Tue Jan 25, 2005 10:26 am
by garvinhicking
That shouldn't be a problem - when calling session_start() multiple times after the first one, it doesn't create new sessions.

So you can use your own session if you use a global_prepend_file in which you start off your custom session, right?

Since we don't use custom sessions, it would be a waste to create a new file for that. This only increases the inclusion load...

But thanks for the thought - we might want to think about moving the session_start() outside of the PHP files and into serendipity_config.inc.php. I'll bring that up on our mailinglist.

Thanks,
Garvin

Posted: Tue Jan 25, 2005 11:24 am
by Guest
Basically I need to require the handler before session_start() is called.

Currently this means just finding every session_start() in any php code and put a require line infront of it.

Do you have a list of the scripts that include a session_start() ?

Another thought is that there might be reason to change the cookie settings with session_set_cookie_params() which as well would have to be done before session_start()

For most users it should be fine like it is now. Maybe just put a list of files that a user that needs those settings can use to add the code lines.

Posted: Tue Jan 25, 2005 11:41 am
by garvinhicking
If you use auto_prepend_file directive, you can include a prepend file before that session_start() is called easily. So you can change all things and create your own sessions without having to mess with Serendipity files :)

Posted: Tue Jan 25, 2005 3:15 pm
by Andragon
After some research I got auto_prepend_file directive into an .htaccess file.

Works great.

here the code in case someone else needs it:

Code: Select all

php_value auto_prepend_file "/absolute-path-to/include.php"

Posted: Tue Jan 25, 2005 3:35 pm
by Andragon
Ok as the Installation needs to write -htaccess you temporaily have to set it to chmod 777 and readd the line after installation.