Repository navigation
Replies: 1 comment 1 reply
|
Hey @orware! Thanks so much for your kind words! ❤️ I'm really happy to hear that you enjoy my work 😄
This is something I actually haven't thought about. I absolutely want LdapRecord to be compatible with this type of server setup (being able to be used it long running processes).
I have this functionality in place at the moment:
Lines 252 to 275 in 415fa35 However -- disconnections do not occur automatically, so I'm assuming this is what is actually causing them to stay open, since you yourself would have to call the method at some point to remove the open
You're right -- I think I need to expand on the docs further in this regard 👍
Do you know if this server eventually (over time, or some other mechanism) tears down instantiated objects using the |
Uh oh!
There was an error while loading. Please reload this page.
I've been working on a mini project this weekend which features LDAP integration and I'm using LdapRecord to provide that functionality (been a long-time user of your packages, going back to 2009 or so, so I'm a big fan :-).
I ended up creating several variations for this mini project, which includes an amphp/http-server that features the LDAP authentication inside of it, which is pretty much my first simple HTTP server using amphp.
One thing I observed was that during my authentication check, when I connected to the LDAP Connections, I was only using
connect(), but wasn't usingdisconnect()(or thereconnect()) methods.This wasn't such a big deal for a short-lived process (such as would be the case for a normal PHP page access), but with the long-lived HTTP server process, this was resulting in the LDAP connections staying open for about 20-30 minutes (and being reused throughout that time) before eventually timing out.
Once the LDAP connection timed out, subsequent attempts to run the
connect()appeared to only result in a "Can't contact LDAP server" message.I believe I've solved it by switching my
connect()calls to bereconnect()calls instead, and also added indisconnect()calls where appropriate and I'm currently running some observations to make sure that this indeed fixes the "Can't contact LDAP server" problem.However, I suppose if I was looking for the best speed possible, leaving the connections open, but being able to reconnect as needed automatically, could be another approach, since the open connections would potentially make things even faster on a server that is receiving a lot of authentication requests, so I wanted to ask how that might be possible (since I didn't really seem to see any examples in the documentation related to using disconnect() and reconnect() directly, or any other methods that might be handy in a scenario like this).
Thank you!
All reactions