Hi,
Is there any alternative to using sessions in serendipity. As per our project's requirements, session cannot be maintained because the project is on multiple servers for load balancing. Instead of using session_start() and $_SESSION is there any other alternative.
Thanks and Regards,
Manoj
Alternative to sessions
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Alternative to sessions
Hi!
You can use the various PHP session drivers, which also make sessions available via DB handlers.
Or you can write your own PHP session handler, that Serendipity will be able to use, because it always uses what's registered to PHP as default.
Best regards,
Garvin
You can use the various PHP session drivers, which also make sessions available via DB handlers.
Or you can write your own PHP session handler, that Serendipity will be able to use, because it always uses what's registered to PHP as default.
Best regards,
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/
# 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/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
No code of Serendipity needs to change, you just need to change the PHP configuration and/or maybe include your custom session handler script via serendipity_config_local.inc.php.
All s9y session write and read calls stay the same because they use the PHP API.
Regards,
Garvin
No code of Serendipity needs to change, you just need to change the PHP configuration and/or maybe include your custom session handler script via serendipity_config_local.inc.php.
All s9y session write and read calls stay the same because they use the PHP API.
Regards,
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/
# 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/
Hi,
I have two more doubts regarding this session handling. Please provide a clarification.
1. What is the scope of $serendipity variable? Where is it defined? $serendipity is defined as 'global' in many functions.
2. How is session handled when application is placed in two different servers for load balancing.
If we comment session_start() in serendipity_config.inc.php and use a global array variable $_SESSION for handling session data, will it work?
Thanks and Regards,
Manoj
I have two more doubts regarding this session handling. Please provide a clarification.
1. What is the scope of $serendipity variable? Where is it defined? $serendipity is defined as 'global' in many functions.
2. How is session handled when application is placed in two different servers for load balancing.
If we comment session_start() in serendipity_config.inc.php and use a global array variable $_SESSION for handling session data, will it work?
Thanks and Regards,
Manoj
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
$serendipity is defined in include/compat.inc.php in the first few lines, and filled in many other files that are included later.
$serendipity is declared on the global level, so only functions need to import it into their local scope by using the 'global' keyword. $serendipity is not a superglobal, because PHP supports no custom superglobals.1. What is the scope of $serendipity variable? Where is it defined? $serendipity is defined as 'global' in many functions.
$serendipity is defined in include/compat.inc.php in the first few lines, and filled in many other files that are included later.
That depends on your implementation of the session handling. If you use a central session storage, then the sessions are shared across load balancing servers.2. How is session handled when application is placed in two different servers for load balancing.
If we comment session_start() in serendipity_config.inc.php and use a global array variable $_SESSION for handling session data, will it work?
[/uote]
That depends on how you think to make $_SESSION persist between request and shared across servers. If you simply make $S_ESSION a global variable, it will be destroyed after each request, and thus not be a session variable that holds contents accross requests.
Best regards,
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/
# 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/