ID: 32144 User updated by: ian at snork dot net Reported By: ian at snork dot net -Status: Feedback +Status: Open Bug Type: SQLite related Operating System: * PHP Version: 5.1.* Assigned To: helly New Comment:
Replacing mawk with gawk solved the problem. Many thanks. Previous Comments: ------------------------------------------------------------------------ [2005-03-09 14:31:09] [EMAIL PROTECTED] You need to install gawk and rebuild. Please verify (for me it helped). ------------------------------------------------------------------------ [2005-03-01 11:43:53] ian at snork dot net Oops -- I meant to say: Moving phpext_sqlite_ptr and phpext_spl_ptr around in that list did _not_ prevent a segfault. Sorry. :) ------------------------------------------------------------------------ [2005-03-01 11:37:42] ian at snork dot net Both SPL and SQLite were built statically into the PHP binary. I was using an unpatched daily snapshot (from http://snaps.php.net/php5-latest.tar.bz2). The ./configure line was: ./configure --without-mime-magic --enable-memory-limit --disable-debug --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-track-vars --enable-trans-sid --enable-bcmath --with-bz2 --enable-ctype --with-db4 --with-iconv --enable-exif --enable-filepro --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex=/usr --enable-shmop --enable-sockets --enable-wddx --disable-xml --with-expat-dir=/usr --with-xmlrpc --enable-yp --with-zlib --with-pgsql=/usr --with-kerberos --with-openssl=/usr --with-exec-dir=/usr/lib/php5/libexec --prefix=/usr --with-apxs2=/usr/bin/apxs2 --with-regex=php --with-config-file-path=/etc/php5/apache2 --disable-rpath --with-curl=/usr --with-dom=/usr --with-dom-xslt=/usr --with-dom-exslt=/usr --with-zlib-dir=/usr --with-gd=/usr --enable-gd-native-ttf --with-jpeg-dir=/usr --with-xpm-dir=/usr/X11R6 --with-png-dir=/usr --with-freetype-dir=/usr --with-imap=/usr --with-imap-ssl --with-mcal=/usr --with-mhash=/usr --without-mm --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-unixODBC=/usr --enable-xslt=/usr --with-xslt-sablot=/usr --with-snmp=/usr --without-sybase-ct --with-ttf=/usr --with-t1lib=/usr --without-custom-odbc --without-odbc --without-unixODBC --without-iodbc --with-sqlite=/usr And here's how they're ordered in the snapshot sources: zend_module_entry *php_builtin_extensions[] = { phpext_xmlrpc_ptr, phpext_xml_ptr, phpext_wddx_ptr, phpext_tokenizer_ptr, phpext_sysvshm_ptr, phpext_sysvsem_ptr, phpext_sysvmsg_ptr, phpext_standard_ptr, phpext_sqlite_ptr, phpext_spl_ptr, phpext_sockets_ptr, phpext_snmp_ptr, phpext_simplexml_ptr, phpext_shmop_ptr, phpext_session_ptr, phpext_posix_ptr, phpext_pgsql_ptr, phpext_pcre_ptr, phpext_mysqli_ptr, phpext_mysql_ptr, phpext_mhash_ptr, phpext_mbstring_ptr, phpext_imap_ptr, phpext_iconv_ptr, phpext_gettext_ptr, phpext_gd_ptr, phpext_ftp_ptr, phpext_filepro_ptr, phpext_exif_ptr, phpext_dom_ptr, phpext_dba_ptr, phpext_curl_ptr, phpext_ctype_ptr, phpext_calendar_ptr, phpext_bz2_ptr, phpext_bcmath_ptr, phpext_zlib_ptr, phpext_openssl_ptr, phpext_libxml_ptr, }; Without the patch I submitted, moving phpext_spl_ptr back or forward in that list did prevent PHP from segfaulting. After doubled-checking with GDB, it appeared that the SPL startup function (zm_startup_spl) was not being called at all. So, I stuck a manual call to PHP_MINIT(spl) in basic_functions.c because it seemed the most logical place for this. ------------------------------------------------------------------------ [2005-03-01 10:27:10] [EMAIL PROTECTED] What is the configure line used? Especially i am interested if spl or sqlite are build shared. And is this a clean cvs checkout or patched somewhere? The reason i ask is that for your problem we have a mechanismn in place already. Also what is the order of 'phpext_spl_ptr' and 'phpext_sqlite_ptr' in main/internal_functions_*.c's 'php_builtin_extensions' array? ------------------------------------------------------------------------ [2005-03-01 09:28:29] ian at snork dot net Description: ------------ A PHP build with --with-spl and --with-sqlite will segfault at startup in all SAPIs because the SPL extension is not initialized at all. The following patch appears to fix the problem: --- php5-200503010530.orig/ext/standard/basic_functions.c 2005-01-18 11:30:05.000000000 +0000 +++ php5-200503010530/ext/standard/basic_functions.c 2005-03-01 08:03:14.578643275 +0000 @@ -1094,6 +1094,9 @@ PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); #endif PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU); +#ifdef HAVE_SPL + PHP_MINIT(spl)(INIT_FUNC_ARGS_PASSTHRU); +#endif PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(url_scanner_ex) (INIT_FUNC_ARGS_PASSTHRU); #ifdef PHP_CAN_SUPPORT_PROC_OPEN Expected result: ---------------- $ sapi/cli/php /dev/null $ Actual result: -------------- $ sapi/cli/php /dev/null Segmentation fault $ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32144&edit=1