ID: 15703 Updated by: [EMAIL PROTECTED] -Summary: Segmentation fault with apache2 php pages not served Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Open -Bug Type: Apache2 related +Bug Type: SWF related Operating System: Red Hat Linux 7.1 PHP Version: 4.1.1 New Comment:
This has been hiding as feedback under Apache2, but it's most likely not Apache2 related, and I didn't want this patch, if valid, to be forgotten. So I'm reopening and reclassifying as SWF related. Thanks... Previous Comments: ------------------------------------------------------------------------ [2002-04-19 11:41:19] [EMAIL PROTECTED] Please try again with Apache 2.0.35 (GA) and PHP from CVS (either the 4.2.0 branch or HEAD). ------------------------------------------------------------------------ [2002-03-08 14:46:48] [EMAIL PROTECTED] I don't know much about cvs and how diff works. So I couldn't make anything out of these lines. One thing I did was, removed --with-swf from configure option and everything worked fine. I want to help but I have a very slow pentium-1 computer and a slow dial up connection (in punjab-IN) so it takes at least one hour to compile php alone. I know little C so if you tell me what to add, what to remove and where then I can make that change and try to compile again and see if that works. ------------------------------------------------------------------------ [2002-03-07 18:00:41] [EMAIL PROTECTED] Hmm .. have you compiled php with thread support? It seems the swf module is missing an ZEND_INIT_MODULE_GLOBALS() call in PHP_MINIT_FUNCTION(). Can you test this patch (against current CVS) ? diff -u -r1.44 swf.c --- swf.c 11 Dec 2001 15:30:38 -0000 1.44 +++ swf.c 7 Mar 2002 22:59:37 -0000 @@ -138,10 +138,19 @@ } /* }}} */ +/* {{{ php_swf_init_globals + */ +static void php_swf_init_globals(zend_swf_globals *swf_globals) { + swf_globals->use_file = 0; + swf_globals->tmpfile_name = NULL; +} + /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(swf) { + ZEND_INIT_MODULE_GLOBALS(swf, php_swf_init_globals, NULL); + REGISTER_LONG_CONSTANT("MOD_COLOR", MOD_COLOR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MOD_MATRIX", MOD_MATRIX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("TYPE_PUSHBUTTON", TYPE_PUSHBUTTON, CONST_CS | CONST_PERSISTENT); ------------------------------------------------------------------------ [2002-03-07 17:04:24] [EMAIL PROTECTED] This time I compiled php with --enable-debug option to generate backtrace.A new file cgisock (0 size) is automatically created after this compile. I think problem is related to swf functions(swf.c). gdb results are at the end: -----------------------------------APACHE 2------------------------------- ./configure --prefix=/wwwroot --enable-auth-anon --enable-auth-db --enable-auth-dbm --enable-auth-digest --enable-file-cache --enable-echo --enable-cache --enable-mem-cache --enable-example --enable-ext-filter --enable-case-filter --enable-case-filter-in --enable-mime-magic --enable-cern-meta --enable-expires --enable-usertrack --enable-unique-id --enable-ssl --enable-optional-hook-export --enable-optional-hook-import --enable-optional-fn-import --enable-optional-fn-export --enable-http --enable-dav --enable-cgi --enable-info --enable-cgid --enable-dav-fs --enable-vhost-alias --enable-speling --enable-actions --enable-rewrite --enable-so --------------------------------------PHP 4.1.1-------------------------- ./configure --prefix=/wwwroot/php --with-apxs2=/wwwroot/bin/apxs --with-mod_charset --with-config-file-path=/wwwroot/php/ --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-cpdflib --with-png-dir --with-jpeg-dir --with-tiff-dir --enable-ctype --with-curl --with-db3 --with-dom --enable-exif --enable-filepro --enable-ftp --with-gd --enable-gd-native-ttf --with-xpm-dir --with-freetype-dir=/usr --with-ttf --with-t1lib --with-gettext --with-gmp --with-hyperwave --with-iconv --with-imap --with-kerberos --with-imap-ssl --with-ircg --with-ldap --enable-mbstring --enable-mbstr-enc-trans --with-mcal=/usr/src/libmcal --with-mhash --with-mnogosearch=/usr/local/mnogosearch --with-mysql --with-pgsql --with-pspell --with-qtdom --enable-trans-sid --enable-shmop --with-snmp -enable-ucd-snmp-hack --enable-sockets --with-regex=php --with-swf --enable-wddx --with-expat-dir=/usr/local --enable-xslt --with-xslt-sablot --with-yaz=/usr/local/lib --enable-yp --with-zip --with-pdflib --enable-versioning --with-tsrm-st --with-tsrm-pthreads --enable-track-vars --enable-overload --with-mcrypt --with-java=/usr/java/j2sdk1.4.0 --enable-sysvsem --enable-sysvshm --enable-debug After making and installing both apache and php when I started apache and tried to access http://localhost. It worked and apache test page was displayed. Then I tried to access a php file with only phpinfo() function. Netscape displayed a message the document contained no date. Follwing was added to apache error_log: ------------------------------------------------------------------------------- [Fri Mar 08 02:12:54 2002] [notice] Digest: generating secret for digest authentication ... [Fri Mar 08 02:12:54 2002] [notice] Digest: done [Fri Mar 08 02:12:55 2002] [notice] Apache/2.0.28 (Unix) mod_ssl/3.0a0 OpenSSL/0.9.6 DAV/2 configured -- resuming normal operations [Fri Mar 08 02:13:16 2002] [error] Optional hook test said: GET / HTTP/1.0 [Fri Mar 08 02:13:16 2002] [error] Optional function test said: GET / HTTP/1.0 [Fri Mar 08 02:13:16 2002] [error] Optional hook test said: GET /apache_pb.gif HTTP/1.0 [Fri Mar 08 02:13:16 2002] [error] Optional function test said: GET /apache_pb.gif HTTP/1.0 [Fri Mar 08 02:14:47 2002] [notice] child pid 4472 exit signal Segmentation fault (11) -------------------------------------------------------------------- I stoped apache removed all logs files and tried /wwwroot/bin/httpd -X after running 'ulimit -c unlimited' and then accessed a php file with phpinfo() and lynx displayed unable to access start document...unkonwn network error and exited. /wwwroot/bin/httpd -X produced: Segmentation fault and exited. No core file is produced under /wwwroot/bin (/wwwroot is apache 2.0 install directory). /wwwroot/bin has write permission for everyone. Then I tried the second option like this and was successful: ------------------------------------------- gdb /wwwroot/bin/httpd GNU gdb 5.0rh-5 Red Hat Linux 7.1 Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) run -X Starting program: /wwwroot/bin/httpd -X [New Thread 1024 (LWP 763)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 763)] 0x405e52c1 in zm_activate_swf (type=1, module_number=8, tsrm_ls=0x81e7210) at swf.c:173 173 SWFG(use_file) = 0; (gdb) bt #0 0x405e52c1 in zm_activate_swf (type=1, module_number=8, tsrm_ls=0x81e7210) at swf.c:173 #1 0x404b08f1 in module_registry_request_startup (module=0x81f7c00, tsrm_ls=0x81e7210) at zend_API.c:1145 #2 0x404b2b3d in zend_hash_apply (ht=0x407dee40, apply_func=0x404b08c8 <module_registry_request_startup>, tsrm_ls=0x81e7210) at zend_hash.c:669 #3 0x404ad2fe in zend_activate_modules (tsrm_ls=0x81e7210) at zend.c:577 #4 0x404ba9e0 in php_request_startup (tsrm_ls=0x81e7210) at main.c:684 #5 0x404b8fd7 in php_apache_request_ctor (f=0x819c244, ctx=0x8190d7c, tsrm_ls=0x81e7210) at sapi_apache2.c:290 #6 0x404b90ff in php_output_filter (f=0x819c244, bb=0x819c3bc) at sapi_apache2.c:326 #7 0x080c12bc in ap_pass_brigade (next=0x819c244, bb=0x819c3bc) at util_filter.c:276 #8 0x080c7659 in default_handler (r=0x81872c4) at core.c:2785 #9 0x080b67b4 in ap_run_handler (r=0x81872c4) at config.c:185 #10 0x080b6cf6 in ap_invoke_handler (r=0x81872c4) at config.c:344 #11 0x0808c2ce in ap_process_request (r=0x81872c4) at http_request.c:286 #12 0x0808853e in ap_process_http_connection (c=0x8182f44) at http_core.c:289 #13 0x080bf9f0 in ap_run_process_connection (c=0x8182f44) at connection.c:82 #14 0x080bfb85 in ap_process_connection (c=0x8182f44) at connection.c:219 #15 0x080b5390 in child_main (child_num_arg=0) at prefork.c:803 ---Type <return> to continue, or q <return> to quit-- #16 0x080b5441 in make_child (s=0x8105994, slot=0) at prefork.c:839 #17 0x080b5553 in startup_children (number_to_start=5) at prefork.c:913 #18 0x080b5997 in ap_mpm_run (_pconf=0x81031ec, plog=0x814b42c, s=0x8105994) at prefork.c:1129 #19 0x080baac8 in main (argc=2, argv=0xbffffa14) at main.c:432 #20 0x402dfe5e in __libc_start_main (main=0x80ba588 <main>, argc=2, ubp_av=0xbffffa14, init=0x8063240 <_init>, fini=0x80d1950 <_fini>, rtld_fini=0x4000d3c4 <_dl_fini>, stack_end=0xbffffa0c) at ../sysdeps/generic/libc-start.c:129 (gdb) ------------------------------------------------------------------------ [2002-02-27 15:20:29] [EMAIL PROTECTED] I did read the README file in sapi/apache2filter directory. But I think it wasn't mentioned there that we should use Apache 2_0_31. Anyway, I started from scratch again and tried each step one by one. I forgot to generate back trace but I will generate it next time. But this time I tried various configurations which are given below. In some cases php 4.1.1 and apache 2_0_28 did work. FIRST CONFIGURATION ---------- ---------------------Apache 2.0-------------- ./configure --prefix=/wwwroot --enable-so ---------------------PHP 4.1.1----------------- ./configure --prefix=/wwwroot/php --with-mysql --with-java=/usr/java/j2sdk1.4.0 php did work and phpinfo() displayed information java library was loaded. But when jver.php was accessed lynx exited with following error: Looking up localhost Making HTTP connection to localhost Sending HTTP request. HTTP request sent; waiting for response. Alert!: Unexpected network read error; connection aborted. Can't Access `http://localhost/jver.php' Alert!: Unable to access document. nothing was added to logs/error_log or to php error log file (php error logging was enabled and a file name was specified) no segmentation fault etc was entered in error log. Then I did this: export LD_LIBRARY_PATH=/usr/java/j2sdk1.4.0/jre/lib/i386/native_threads:/usr/java/j2sdk1.4.0/jre/lib/i386/client:/usr/java/j2sdk1.4.0/jre/lib/i386; Every thing worked and when jver.php (sample file provided with java ext) was accessed java version etc. was displayed. extension directory created was: /wwwroot/php/lib/php/extensions/no-debug-zts-20010901/ Second Time ----------- ---------------Apache 2.0 Configure Options------------------- ./configure --prefix=/wwwroot --enable-auth-anon --enable-auth-db --enable-auth-dbm --enable-auth-digest --enable-file-cache --enable-echo --enable-cache --enable-mem-cache --enable-example --enable-ext-filter --enable-case-filter --enable-case-filter-in --enable-mime-magic --enable-cern-meta --enable-expires --enable-usertrack --enable-unique-id --enable-ssl --enable-optional-hook-export --enable-optional-hook-import --enable-optional-fn-import --enable-optional-fn-export --enable-http --enable-dav --enable-cgi --enable-info --enable-cgid --enable-dav-fs --enable-vhost-alias --enable-speling --enable-actions --enable-rewrite --enable-so ------------------------------PHP 4.1.1 ------------------------------ ./configure --prefix=/wwwroot/php --with-mysql --with-java=/usr/java/j2sdk1.4.0 --with-apxs2=/wwwroot/bin/apxs --with-config-file-path=/wwwroot/php phpinfo() worked and java library was loaded. Java (jver.php) worked after exporting this: export LD_LIBRARY_PATH=/usr/java/j2sdk1.4.0/jre/lib/i386/native_threads:/usr/java/j2sdk1.4.0/jre/lib/i386/client:/usr/java/j2sdk1.4.0/jre/lib/i386; and displayed this: Java version=1.4.0-beta Java vendor=Sun Microsystems Inc. OS=Linux 2.4.3-12 on i386 Wednesday, February 27, 2002 at 3:29:02 AM India Standard Time But following was added to apache 2.0 error_log: [Wed Feb 27 03:28:22 2002] [notice] Apache/2.0.28 (Unix) mod_ssl/3.0a0 OpenSSL/0.9.6 DAV/2 configured -- resuming normal operations [Wed Feb 27 03:29:03 2002] [error] Optional hook test said: GET /jver.php HTTP/1.0 [Wed Feb 27 03:29:03 2002] [error] Optional function test said: GET /jver.php HTTP/1.0 [Wed Feb 27 03:31:00 2002] [error] Optional hook test said: GET /jver.php HTTP/1.0 [Wed Feb 27 03:31:00 2002] [error] Optional function test said: GET /jver.php HTTP/1.0 ------------ THIRD TIME ------------ Then I made a distclean in php-4.1.1 directory. stopped apache 2.0. Removed directory /wwwroot/php. And configured and installed php with following options.. ------------------------------PHP 4.1.1 Configure--------------------- ./configure --prefix=/wwwroot/php --with-apxs2=/wwwroot/bin/apxs --with-mod_charset --with-config-file-path=/wwwroot/php/ --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-cpdflib --with-png-dir --with-jpeg-dir --with-tiff-dir --enable-ctype --with-curl --with-db3 --with-dom --enable-exif --enable-filepro --enable-ftp --with-gd --enable-gd-native-ttf --with-xpm-dir --with-freetype-dir=/usr --with-ttf --with-t1lib --with-gettext --with-gmp --with-hyperwave --with-iconv --with-imap --with-kerberos --with-imap-ssl --with-ircg --with-ldap --enable-mbstring --enable-mbstr-enc-trans --with-mcal=/usr/src/libmcal --with-mhash --with-mnogosearch=/usr/local/mnogosearch --with-mysql --with-pgsql --with-pspell --with-qtdom --enable-trans-sid --enable-shmop --with-snmp -enable-ucd-snmp-hack --enable-sockets --with-regex=php --with-swf --enable-wddx --with-expat-dir=/usr/local --enable-xslt --with-xslt-sablot --with-yaz=/usr/local/lib --enable-yp --with-zip --with-pdflib --enable-versioning --with-tsrm-st --with-tsrm-pthreads --enable-track-vars --enable-overload --with-mcrypt --with-java=/usr/java/j2sdk1.4.0 --enable-sysvsem --enable-sysvshm This time when I restarted apache 2.0 php didn't work and lynx exited with same Unknown network error message. Following was added to apache logs/error_log [Wed Feb 27 19:44:25 2002] [notice] Digest: done [Wed Feb 27 19:44:26 2002] [notice] Apache/2.0.28 (Unix) mod_ssl/3.0a0 OpenSSL/0.9.6 DAV/2 configured -- resuming normal operations [Wed Feb 27 19:44:39 2002] [notice] child pid 645 exit signal Segmentation fault (11) [Wed Feb 27 19:45:31 2002] [notice] child pid 646 exit signal Segmentation fault (11) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15703 -- Edit this bug report at http://bugs.php.net/?id=15703&edit=1