From: chris at seismo dot usbr dot gov dot spamfree Operating system: IRIX 6.5 PHP version: 4.3.5RC3 PHP Bug Type: iPlanet related Bug description: nsapi will not load for NS/Iplanet ver 3 and 4
Description: ------------ NSAPI with old versions of Netscape Enterprise Server (3 and 4) bombs when the server tries to load it. PHP-cli works fine. And if one removes the load statements from obj.conf, the server has no problem (and no PHP). On Irix 6.5, the startup error with PHP NSAPI is "PANIC pt_bootstrap() Couldn't INIT_THREADS - {0x0, 0x0}". The basic problem here is that NS/Iplanet versions 3 and 4 do not support pthreads whereas PHP requires them (sort of). See article: http://kb.netscape.com/NASApp/kb/Article?id=2861 Although NS/Iplanet has threads, they are not pthreads. To get a working NSAPI, one must use NSAPI threads instead. That's a big problem because TSRM wants pthreads. So the issue is simply how to build NSAPI without pthreads. It can be done with 3 simple fixes: (1) TSRM fixes; (2) use correct configure flags; (3) configure hacks. (Note that php-cli needs to be built separately) ##### FIRST TSRM.h mostly *has* support for NSAPI threads, it's just that the pthread ifdef's are reached first. Also, a couple of lines are missing. Here are the few simple code changes that are needed (sorry, I don't have CVS): In NSAPI.h change #elif defined(PTHREADS) # define THREAD_T pthread_t # define MUTEX_T pthread_mutex_t * #elif defined(PI3WEB) to #elif defined(PTHREADS) # define THREAD_T pthread_t # define MUTEX_T pthread_mutex_t * #elif defined(NSAPI) # define THREAD_T SYS_THREAD # define MUTEX_T CRITICAL #elif defined(PI3WEB) In TSRM.c, change #elif defined(NSAPI) return crit_enter(mutexp) #elif defined(PI3WEB) to #elif defined(NSAPI) crit_enter(mutexp); /* returns void */ return crit_enter(mutexp); #elif defined(PI3WEB) and also change #elif defined(NSAPI) return crit_exit(mutexp); #elif defined(PI3WEB) to #elif defined(NSAPI) crit_exit(mutexp); /* returns void */ return 0; #elif defined(PI3WEB) In nsapi.h, be sure to define XP_UNIX, or do it in configure. ##### SECOND Make sure the following flags are given to configure: --with-nsapi=/your/path/to/Netscape/3.5 --without-tsrm-pthreads --disable-cli --without-pear ##### THIRD Configure needs to be modified for several things to disable any use of pthreads and set CFLAGS for NSAPI threads: (1) For NS 3 and 4, don't use pthreads (2) Make sure CFLAGS="$CFLAGS -DNSAPI -DXP_UNIX" (3) Make sure -lpthread is never used (4) Make sure there's no pthread support in main/php_config.h A quick, if ugly hack to configure that does that is to change occurrences of if test "$cross_compiling" = yes"; then to if test "$cross_compiling" = yes -o "ugly" = "ugly" ; then A more elegant fix would change sapi/nsapi/config.m4 to reflect the logic: if (NS3 or 4) -> no pthreads, and define(NSAPI and XP_UNIX). Build and install following the instructions in the PHP manual for NSAPI, and that's it. This appears to have been a problem many others have had (e.g., bugs 4982, 13174, 10821, 4504, 6939, 9612, 2019, 10012, 25517, 11039, 11174, 12258, 5120, 23269, 6439, 11656, 4404, 14634, 6196, 18701, 12466, 16418, 15439, 16996, 5536, 8376). Hope this helps. Expected result: ---------------- ./ns-httpd -d config Netscape-Enterprise/3.5.1 B98.027.1047 startup: listening to http://our.web.server, port 80 as web Actual result: -------------- ./ns-httpd -d config Netscape-Enterprise/3.5.1 B98.027.1047 startup: listening to http://our.web.server, port 80 as web PANIC pt_bootstrap() Couldn't INIT_THREADS - {0x0, 0x0} (pt_bootstrap is from libpthreads.so on IRIX). -- Edit bug report at http://bugs.php.net/?id=27412&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27412&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27412&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27412&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27412&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27412&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27412&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27412&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27412&r=support Expected behavior: http://bugs.php.net/fix.php?id=27412&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27412&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27412&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27412&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27412&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27412&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27412&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27412&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27412&r=float