ID:               21829
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Sockets related
 Operating System: mandrake 8.2, 2.4.18-8.1mdk
 PHP Version:      4.3.0
 New Comment:

I found the cause of this.  Somehow in my exported INCLUDE
-I/usr/include had come before -I/usr/local/bind/include, and the DNS
structures were taken from the wrong header files.  After setting the
BIND include files to be searched first and recompiling, this appears
to be resolved.


Previous Comments:
------------------------------------------------------------------------

[2003-01-22 19:42:25] [EMAIL PROTECTED]

Compiling 4.3.0 and php4-STABLE-200301222030 on 3 servers, one works
and two segfault.  The simple script below illustrates the problem; on
one server it runs, on two it faults.  The three servers are
essentially identical; php.ini on all are identical.

Build details and gdb backtrace are below.  I also have
fopen("http://";) failing the same way, not surprising.  The failure
appears to be in DNS resolution.  Glad to supply more info as needed.

<?php
$fd = fsockopen("www.yahoo.com", 80, &$errno, &$errstr);
if( !$fd ) {
    echo "yahoo not available";
    exit();
} else {
    fputs($fd,"GET / HTTP/1.0\r\n\r\n");
    fputs($fd,"Host: $host\r\n\r\n");
    while (!feof($fd)) {
        echo fread($fd,16000);
    }
    fclose($fd);
}
?>

=================================================

php was built with the following options:

./configure \
 --with-gd \
 --with-mysql=/usr \
 --with-exec-dir=/var/lib/php \
 --with-java=/usr/local/jdk \
 --enable-unified-odbc \
 --enable-safe-mode=yes \
 --enable-track-vars \
 --enable-ftp \
 --with-expat-dir=/usr \
 --with-xml \
 --with-dom=/usr \
 --with-dom-xslt=/usr \
 --with-dom-exslt=/usr \
 --enable-xslt \
 --with-xslt-sablot=/usr \
 --with-sablot-js=/usr \
 --with-zlib \
 --with-ldap \
 --with-openssl \
 --disable-debug \
 --disable-debugger \
 --with-config-file-path=/etc/httpd/conf

The bind version on all servers is 8.3.3, patched with ISC patches
prior to 8.3.4 release from recent bugs.

=================================================

gdb run commands:

gdb stacktrace:(gdb) set args fsock_yahoo.php
(gdb) run
Starting program: /usr/local/bin/php fsock_yahoo.php
[New Thread 1024 (LWP 3639)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 3639)]
0x081335d5 in php_network_getaddresses (host=0x831c59c "www.yahoo.com",

    sal=0xbfffc634) at /usr/local/php4/main/network.c:215
215                                     *(struct sockaddr_in *)*sap =


#0  0x081335d5 in php_network_getaddresses (host=0x831c59c
"www.yahoo.com", 
    sal=0xbfffc634) at /usr/local/php4/main/network.c:215
#1  0x08133810 in php_hostconnect (host=0x831c59c "www.yahoo.com",
port=80, 
    socktype=1, timeout=0xbfffc6b0) at
/usr/local/php4/main/network.c:410
#2  0x08133b5f in _php_stream_sock_open_host (host=0x831c59c
"www.yahoo.com", 
    port=80, socktype=1, timeout=0xbfffc6b0, persistent_id=0x0)
    at /usr/local/php4/main/network.c:619
#3  0x080ee025 in php_fsockopen_stream (ht=4, return_value=0x831c5dc, 
    this_ptr=0x0, return_value_used=1, persistent=0)
    at /usr/local/php4/ext/standard/fsock.c:218
#4  0x080ee1ed in zif_fsockopen (ht=4, return_value=0x831c5dc,
this_ptr=0x0, 
    return_value_used=1) at /usr/local/php4/ext/standard/fsock.c:278
#5  0x0815d2d2 in execute (op_array=0x8322504)
    at /usr/local/php4/Zend/zend_execute.c:1596
#6  0x0814cdf3 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/local/php4/Zend/zend.c:864
#7  0x0812992b in php_execute_script (primary_file=0xbffff560)
    at /usr/local/php4/main/main.c:1573
#8  0x08164488 in main (argc=2, argv=0xbffff604)
    at /usr/local/php4/sapi/cli/php_cli.c:746
#9  0x405be280 in __libc_start_main () from /lib/libc.so.6


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21829&edit=1

Reply via email to