php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19611 php cgi crashes at startup
Submitted: 2002-09-26 05:49 UTC Modified: 2002-09-26 07:34 UTC
From: info at edv-rosenthal dot de Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.2.3 OS: Debian 3.0 (Woody)
Private report: No CVE-ID: None
 [2002-09-26 05:49 UTC] info at edv-rosenthal dot de
simply calling php with any php script or without.
"do_conf mod" (see configure script) compiled works fine on same machine.

my configure script:
---cut "cat do_conf"---
#!/bin/sh
OPTIONS="--program-suffix=.4.2.3 \
--prefix=/usr/local/php4.2.3 \
--with-mm \
--with-layout=GNU \
--enable-safe-mode \
--with-openssl \
--with-zlib-dir=/usr/local \
--with-zlib \
--with-bz2 \
--with-jpeg-dir=/usr/local \
--with-tiff-dir=/usr/local \
--with-db3 \
--with-dom \
--with-dom-xslt \
--with-dom-exslt \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/local \
--with-t1lib=/usr/local \
--with-iconv \
--with-imap\
--with-imap-ssl \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr \
--with-pdflib \
--with-png-dir \
--enable-sockets \
--with-sybase=/usr/local \
--enable-sysvsem \
--enable-sysvshm \
--enable-tokenizer \
--with-expat-dir=/usr/local \
--enable-xslt \
--with-xslt-sablot=/usr/local \
--enable-versioning \
--enable-inline-optimization \
--with-oci8 \
--enable-sigchild \
--enable-memory-limit \
--enable-debug"

case "$1" in
cgi)
  echo -e "Configuring for CGI\n"
;;
mod|module)
  echo -e "Configuring for Module\n"
  OPTIONS="--with-apache=/usr/src/apache_1.3.26 $OPTIONS"
;;
shd|shared|dso)
  echo -e "Configuring for DSO\n"
  OPTIONS="--with-apxs=/usr/local/apache/bin/apxs $OPTIONS"
;;
*)
  echo -e "Usage: $0 (cgi|mod|module|shd|shared|dso)"
  exit 0
;;
esac

ORACLE_HOME=/opt/oracle \
./configure $OPTIONS
---cut---

backtrace:
root@cvsserver:~/php_test # gdb /usr/local/php4.2.3/bin/php
GNU gdb 2002-04-01-cvs
Copyright 2002 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-linux"...
(gdb) run phpinfo.php
Starting program: /usr/local/php4.2.3/bin/php phpinfo.php
[New Thread 1024 (LWP 5968)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 5968)]
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x40259928 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#2  0x402599e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#3  0x402583fe in _nss_db_endprotoent () from /lib/libnss_db.so.2
#4  0x40258668 in _nss_db_getprotobyname_r () from /lib/libnss_db.so.2
#5  0x40daf2cf in getprotobyname_r () from /lib/libc.so.6
#6  0x40daf17d in getprotobyname () from /lib/libc.so.6
#7  0x080e2bce in zm_startup_sockets (type=1, module_number=8) at sockets.c:419
#8  0x0815f97b in zend_startup_module (module=0x81c3380) at zend_API.c:1007
#9  0x0806f8b6 in php_startup_extensions (ptr=0x81bf8b4, count=26) at main.c:833
#10 0x08078be5 in php_startup_internal_extensions () at internal_functions.c:94
#11 0x0806fcc5 in php_module_startup (sf=0x81bc020) at main.c:991
#12 0x0806d4ff in main (argc=2, argv=0xbffffb54) at cgi_main.c:472

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-26 06:20 UTC] mfischer@php.net
From the backtrace it seems that the crash occurs in your system libraries out of control of php.

PHP simply tries to determine whether your system supports TCP:

ff ((pe = getprotobyname("tcp"))) {

but it crashes upon the call to getprotobyname() which is a system function. There isn't anything obvious wrong with the call.

Please narrow down the configure options to only --enable-sockets and/or try http://snaps.php.net/php4-latest.tar.bz2 .

But I think the problem is on your system because the crash happens in /lib/libnss_db.so.2
 [2002-09-26 07:26 UTC] info at edv-rosenthal dot de
1. compiled only with --enable-sockets it doesn't result in an seg_fault

2. why is it working as apache-module (same options) and dso, but not as cgi?
 [2002-09-26 07:30 UTC] sniper@php.net
Can you please try the snapshot?

 [2002-09-26 07:32 UTC] info at edv-rosenthal dot de
solved...

edited nsswitch.conf not to look at db for protocols, and... Up and running.

Question:
Should this really result in a segmentation fault? (Exception handling?)
 [2002-09-26 07:34 UTC] info at edv-rosenthal dot de
tried it with the snapshot, too...
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Feb 13 17:00:01 2026 UTC