From: jdolecek at NetBSD dot org Operating system: Mac OS X 10.4.10 PHP version: 5.2.4 PHP Bug Type: Dynamic loading Bug description: Dynamically loaded PHP extensions need symbols exported
Description: ------------ Some PHP extensions expect to have symbols from other PHP extensions available. This is the case for PDO drivers (which use symbols from PDO extension) and XSL (which uses symbols from DOM extension). Extensions are loaded with dlopen(..., RTLD_GLOBAL) on platforms with dlopen() (i.e. most unices). On Mac OS X, NSLinkModule() is used instead of dlopen(), but with 'private' option, which hides symbols of dynamically loaded extensions from other dynamically loaded code. Due to this symbol hiding, PDO and DOM needed to be compiled into base PHP binary, otherwise the dependant extension couldn't be dynamically loaded since expected symbols are not found. PDO configure script even intentionally silently disables compilation of dynamically loaded PDO module on MacOSX/Darwin because of this. Following patch makes it possible to load also PDO and DOM dynamically on Mac OS X and thus PHP extensions work all the same way as on other UNIX systems: --- Zend/zend_extensions.c.orig 2007-09-11 22:00:50.000000000 +0200 +++ Zend/zend_extensions.c @@ -243,7 +243,7 @@ void *zend_mh_bundle_load(char* bundle_p return NULL; } - bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_PRIVATE); + bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_NONE); NSDestroyObjectFileImage(bundle_image); /* call the init function of the bundle */ Reproduce code: --------------- Compile PDO (after fix to configure script) as dynamic extensions, as well as pdo_mysq, and add into php.ini lines: extension=pdo.so extension=pdo_mysql.so then run: php -m | grep -i pdo Expected result: ---------------- PDO pdo_mysql Actual result: -------------- dyld: lazy symbol binding failed: Symbol not found: _php_pdo_declare_long_constant Referenced from: /Users/Shared/pkg/lib/php/20040412/pdo_mysql.so Expected in: flat namespace dyld: Symbol not found: _php_pdo_declare_long_constant Referenced from: /Users/Shared/pkg/lib/php/20040412/pdo_mysql.so Expected in: flat namespace Trace/BPT trap -- Edit bug report at http://bugs.php.net/?id=42629&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42629&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42629&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42629&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42629&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42629&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42629&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42629&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42629&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42629&r=support Expected behavior: http://bugs.php.net/fix.php?id=42629&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42629&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42629&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42629&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42629&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42629&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42629&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42629&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42629&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42629&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42629&r=mysqlcfg