Making it all talk to each other
No Function-scoped Static Objects
void example() {
   static std::string str;
}
gcc 3.x has -fuse-cxa-atexit and your libc needs to support __cxa_atexit() in order to solve this problem. Other than that, if you can't change the code, patch PHP to not dlclose() the shared extensions on shutdown to avoid the crash. See http://lerdorf.com/dlclose.txt for the patch.

Throwing C++ exceptions
If a C++ shared library is loaded by a C runtime, like PHP, you could end up with weird __throw() problems. An annoying workaround is to link your C runtime against libstdc++.so to prevent the linker from pulling in the __throw symbol from libgcc.a.