Hi,
I have done some further debugging. php -m loads ldap.so (a plugin for LDAP functions). ldap.so depends on openldap libraries (libldap.so, ..) which are by default loaded lazy (RTLD_LAZY). When I compile everything and enforce direct loading via ld (-Wl,-z,now) the segfault disappear. The problem is that dlclose() tries to run destructor functions (DT_FINI/DT_FINI_ARRAY) from libldap.so, which was never bound.
What would be the correct way to prevent this?
Any hints are welcome.
best regards Waldemar