Custom Session Handler Problem

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Andragon

Custom Session Handler Problem

Post 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 ;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom Session Handler Problem

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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 :)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Andragon

Post 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"
Andragon

Post 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.
Post Reply