PHP5 + oci8 consistently segfaults on script exit

Gordon Stratton tsr2600 at gmail.com
Wed Sep 12 23:14:05 PDT 2007


I've implemented a solution that works around the problem. I'm fairly
sure that the Oracle shared library is doing something incorrect such as
registering functions via atexit(3). When the module is unloaded and PHP
exits, the called functions have since been unmapped so calling them
results in a segfault. Does this sound plausible? In any case, my
workaround is to comment out the call to the macro DL_UNLOAD in
Zend/zend_API.c (the macro expands to the call to dlclose(3) on FreeBSD
and other platforms). Doing it at that point works out because PHP
always exits after dlclose(3)ing all of its extensions (hence the
segfault), but clearly it is not an elegant or clean solution.

I have prepared a patch which I am using in my local ports tree that
comments out DL_UNLOAD as I mentioned earlier, and everything is working
just fine (CLI and mod_php) on FreeBSD 6.2 with PHP 5.2.3 and
oracle8-client-0.1.1_1.

If anyone is interested in this patch, contact me off-list.

Gordon


More information about the freebsd-database mailing list