# Memcache session handler

- Thread: https://externals.io/message/26103
- Original archive: https://news-web.php.net/php.internals/26103
- Started by Glenn Richmond on 2006-10-20T04:35:13+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #26103 — Glenn Richmond — 2006-10-20T04:35:13+00:00

URL: https://externals.io/message/26103#26103

Hi all,

I've just been implementing a memcache session handler that allows for
multiple servers in a cluster to store their session data in a central
place. I had to make the changes in the PHP source as the user session
handler doesn't quite work properly (it wipes the references to the PHP
functions when session_write_close is called). Anyway, so it's all
working quite well (still undergoing testing) and it works with a main
memcache server and a backup as a failover. I'd like to check the code
back into the source tree if it's something that might be of use to the
general community and am told that this is the list to discuss this?

So a couple of queries:

    * Is this something worth checking back into the main source tree?
    * How do I get registered as a developer or can I provide it as a
      .diff to an existing developer?

Best Regards,

Glenn Richmond.

---

## #26110 — Antony Dovgal — 2006-10-20T08:39:39+00:00

URL: https://externals.io/message/26103#26110 · In reply to: #26103

> Hi all,
> 
> I've just been implementing a memcache session handler that allows for
> multiple servers in a cluster to store their session data in a central
> place. I had to make the changes in the PHP source as the user session
> handler doesn't quite work properly (it wipes the references to the PHP
> functions when session_write_close is called). Anyway, so it's all
> working quite well (still undergoing testing) and it works with a main
> memcache server and a backup as a failover. I'd like to check the code
> back into the source tree if it's something that might be of use to the
> general community and am told that this is the list to discuss this?
> 
> So a couple of queries:
> 
>     * Is this something worth checking back into the main source tree?
>     * How do I get registered as a developer or can I provide it as a
>       .diff to an existing developer?

I guess you need to contact current PECL/memcache developers.

-- 
Wbr, 
Antony Dovgal

---

## #26111 — Glenn Richmond — 2006-10-20T08:49:55+00:00

URL: https://externals.io/message/26103#26111 · In reply to: #26110

Hi Antony,

This isn't actually part of the PECL project as I understand it. The
PECL memcache project provides a PHP interface to using a memcache
server. What I've developed is a memcache session handler  that can be
used via the php.ini file by:

session.handler = memcache

As such, it's something that could (or perhaps should) be part of the
main source tree. Is there a middle stage here? i.e. Can I provide it as
an optional compile flag in the configure script?

Glenn.

Antony Dovgal wrote:
> 
> > […]
>
> I guess you need to contact current PECL/memcache developers.

---

## #26116 — Antony Dovgal — 2006-10-20T09:00:54+00:00

URL: https://externals.io/message/26103#26116 · In reply to: #26111

> Hi Antony,
> 
> This isn't actually part of the PECL project as I understand it. The
> PECL memcache project provides a PHP interface to using a memcache
> server. What I've developed is a memcache session handler  that can be
> used via the php.ini file by:

Yes, I understand that.
I just expected a session handler would use the existing interface to memcache instead of reinventing the wheel.
Am I wrong?

> session.handler = memcache
> 
> As such, it's something that could (or perhaps should) be part of the
> main source tree. Is there a middle stage here? i.e. Can I provide it as
> an optional compile flag in the configure script?

I personally don't think it could/should be a merged into the core, 
while I'm absolutely fine with merging it to PECL/memcache.

-- 
Wbr, 
Antony Dovgal

---

## #26117 — Glenn Richmond — 2006-10-20T09:10:01+00:00

URL: https://externals.io/message/26103#26117 · In reply to: #26116

ok, sure - I just made this assumption because there's an sqlite session
handler in there (from what I can see) that I wouldn't have considered
standard. I'll discuss with the PECL developers.

Glenn.

Antony Dovgal wrote:
> 
> > […]
>
> Yes, I understand that.
> I just expected a session handler would use the existing interface to
> memcache instead of reinventing the wheel.
> Am I wrong?
>
> > […]
>
> I personally don't think it could/should be a merged into the core,
> while I'm absolutely fine with merging it to PECL/memcache.

---

## #26118 — Andreas Korthaus — 2006-10-20T09:10:04+00:00

URL: https://externals.io/message/26103#26118 · In reply to: #26111

Hi Glenn,

Glenn Richmond wrote:
> This isn't actually part of the PECL project as I understand it. The
> PECL memcache project provides a PHP interface to using a memcache
> server. What I've developed is a memcache session handler  that can be
> used via the php.ini file by:
> 
> session.handler = memcache

That's exactly what you can do with an extension. Perhaps look at 
eAccelerator for an example:

http://eaccelerator.net/browser/eaccelerator/trunk/session.c

> As such, it's something that could (or perhaps should) be part of the
> main source tree. Is there a middle stage here? i.e. Can I provide it as
> an optional compile flag in the configure script?

I think PECL:memcache is the perfect place for such a session-handler.


best regards
Andreas

---

## #26119 — Glenn Richmond — 2006-10-20T09:20:28+00:00

URL: https://externals.io/message/26103#26119 · In reply to: #26118

Hi Andreas,

Thanks for the suggestion - looks like a nice way to separate it from
the main source tree. I'll look at this as an option also :) I think the
one nice thing of integrating with the PECL memcache project would be
re-using the memcache library backend, but will see how we go.

Regards,

Glenn.

Andreas Korthaus wrote:
> Hi Glenn,
>
> Glenn Richmond wrote:
> > […]
>
> That's exactly what you can do with an extension. Perhaps look at
> eAccelerator for an example:
>
> http://eaccelerator.net/browser/eaccelerator/trunk/session.c
>
> > […]
>
> I think PECL:memcache is the perfect place for such a session-handler.
>
>
> best regards
> Andreas
