From:             [EMAIL PROTECTED]
Operating system: RedHat 7.2
PHP version:      4.3.0
PHP Bug Type:     Sockets related
Bug description:  Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect 
failed 

Script:
-------------------------
<?php
$fp = fsockopen ("localhost", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br>\n";
}
fclose ($fp);
?>

Output:
-------------------------
Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect failed
in /home/virtual/site1/fst/var/www/html/t5.php on line 2
Warning: fsockopen() [function.fsockopen]: unable to connect to
localhost:80 in /home/virtual/site1/fst/var/www/html/t5.php on line 2
Operation now in progress (115)
Warning: fclose(): supplied argument is not a valid stream resource in
/home/virtual/site1/fst/var/www/html/t5.php on line 6

Modules:
---------------------------
./configure' 'i386-redhat-linux' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib'
'--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc'
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3'
'--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-png-dir=/usr'
'--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm'
'--with-gettext=shared' '--with-ncurses' '--with-gmp' '--with-iconv'
'--with-jpeg-dir=/usr' '--with-openssl' '--with-pear' '--with-png'
'--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib'
'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif'
'--enable-ftp=shared' '--enable-magic-quotes' '--enable-safe-mode'
'--enable-sysvsem=shared' '--enable-sysvshm=shared'
'--enable-discard-path' '--enable-track-vars' '--enable-trans-sid'
'--enable-yp' '--enable-wddx' '--without-oci8' '--enable-sockets'
'--with-imap=shared' '--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql' '--with-pgsql=shared' '--with-snmp=shared'
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio'
'--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans'
'--disable-experimental-zts' '--with-apxs=/usr/sbin/apxs' '--enable-debug'


Additional information:
----------------------
The same script is running at the command prompt.
$result = socket_connect ($socket, "localhost", 80); is running fine on
prompt and into browser.
I am sure www service is up and running. There is no internal firewall
rules on the machine.

gdb backtrace:
----------------------------
I configured with --enable-debug 
[root@ensim html]# gdb /usr/sbin/httpd
GNU gdb Red Hat Linux (5.2-2)
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-redhat-linux"...
(no debugging symbols found)...
(gdb) run -X
Starting program: /usr/sbin/httpd -X
[New Thread 1024 (LWP 3641)]
Processing config directory: /etc/appliance/apacheconf
 Processing config file: /etc/appliance/apacheconf/apache
Processing config directory: /etc/httpd/conf/virtual
 Processing config file: /etc/httpd/conf/virtual/site1
Processing config directory: /etc/httpd/conf/site1
 Processing config file: /etc/httpd/conf/site1/cgi
 Processing config file: /etc/httpd/conf/site1/frontpage
 Processing config file: /etc/httpd/conf/site1/mod_perl
 Processing config file: /etc/httpd/conf/site1/sqmail
 Processing config file: /etc/httpd/conf/site1/ssi
 Processing config file: /etc/httpd/conf/site1/weblogs
 Processing config file: /etc/httpd/conf/virtual/site10
..............................
Processing config directory: /etc/httpd/conf/site99
 Processing config file: /etc/httpd/conf/site99/frontpage
 Processing config file: /etc/httpd/conf/site99/sqmail
 Processing config file: /etc/httpd/conf/site99/weblogs
Program exited with code 01.

I can't get a core file.
I didn't get any message at gdb prompt. May be I am doing something
wrong.Please advise.

-- 
Edit bug report at http://bugs.php.net/?id=21653&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21653&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21653&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21653&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21653&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21653&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21653&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21653&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21653&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21653&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21653&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21653&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21653&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21653&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21653&r=gnused

Reply via email to