ID:               21653
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Sockets related
 Operating System: RedHat 7.2
 PHP Version:      4.3.0
 New Comment:

I have a couple scripts that worked 100% of the time under PHP 4.2.3. 
Immediately after the upgrade to PHP 4.3 I get the function.fsockopen:
php_hostconnect errors as well.

Here are two of the links you can launch an "authorized" scan from to
see the errors:

http://www.computercops.biz/modules.php?name=Trojan_TCP_Scan
http://www.computercops.biz/modules.php?name=TCP_Scanner

These pages make use of the same code as posted earlier in this bug
report by [EMAIL PROTECTED]

To reiterate, under PHP 4.2.3 this code worked perfectly fine.  Now PHP
4.3 has broken it and I cannot seem to fix it.


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

[2003-01-21 22:31:28] [EMAIL PROTECTED]

I update my Install Shell Script for the new version Redhat 8.0, I only
use Apache/ModSSL/OpenSSL and PHP with MySQL for start and enable
sockets but sockets don't work, previous version work great [Note I
make the Socket work great since Redhat 6.2 and early version of PHP
4.X.X]

Here is the Script:


#!/bin/sh
# Traigamos los archivos necesarios.

# Traigamos PHP
# Version: 4.3.0
wget http://us2.php.net/distributions/php-4.3.0.tar.gz

# Traigamos Apache
# Version: 1.3.27
wget http://mirrors.ccs.neu.edu/Apache/dist/httpd/apache_1.3.27.tar.gz

# Traigamos OpenSSL
# Version: 0.9.7
wget http://www.openssl.org/source/openssl-0.9.7.tar.gz

# Traigamos ModSSL
# Version: 2.8.9-1.3.27
wget http://www.modssl.org/source/mod_ssl-2.8.12-1.3.27.tar.gz

# Traigamos GD Boutell
# Version: gd-1.8.4
# Ya incluida en PHP 4.3.0 Pero si usas 4.2.3 baja la libreria
# wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz

# Traigamos PDF Lib
# Version: 4.0.2
# wget http://www.pdflib.com/pdflib/download/pdflib-4.0.2-Linux.tar.gz

# Traigamos SWF
# Version: 0.99
# ftp://ftp.sgi.com/sgi/graphics/grafica/flash/dist.99.linux.tar.Z
# Require swf.tar.gz .

# Traigamos Ming
# Version: 0.2a
# wget http://www.opaque.net/ming/ming-0.2a.tgz

# Descomprimimos todos los Archivos.
echo " =>   Extracting FILE PHP-APACHE-PHP-SSL";
tar -zxf php-4.3.0.tar.gz
echo " =>   Extracting PHP OK";
tar -zxf apache_1.3.27.tar.gz
echo " =>   Extracting APACHE OK";
tar -zxf openssl-0.9.7.tar.gz
echo " =>   Extracting OPENSSL OK";
tar -zxf mod_ssl-2.8.12-1.3.27.tar.gz
echo " =>   Extracting MODSSL OK";

# instalamos openssl
cd openssl-0.9.7
make clean
./config --prefix=/usr/local/openssl
make
make test
make install
cd ..
echo " => Install [ OPENSSL OK ] ";



# instalamos modssl
cd mod_ssl-2.8.12-1.3.27
make clean
./configure --with-apache=../apache_1.3.27
cd ..
echo " => Install [ MODSSL OK ] ";

# Configuracion Inicial de Apache
cd apache_1.3.27
make clean
./configure --prefix=/usr/local/apache
cd ..
echo " => Install [ APACHE INITIAL  OK ] ";


# Configuracion e Instalacion de PHP
cd php-4.3.0
make clean
CFLAGS='-O2 -I/usr/local/openssl/include' \
./configure \
--with-apache=../apache_1.3.27 \
--with-mysql \
--with-zlib  \
--enable-memory-limit=yes \
--enable-debug=no \
--enable-track-vars  \
--enable-snmp \
--enable-sockets \
--enable-ftp
make
make install
cd ..
echo " => Install [ PHP OK ] ";

# Instalacion de Apache
cd apache_1.3.27
SSL_BASE=/usr/local/openssl \
LIBS=-lpthread \
./configure \
--prefix=/usr/local/apache \
--enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--enable-module=php4 \
--enable-module=auth_dbm \
--enable-module=auth_db
make
make certificate
make install
cd ..
echo " => Install [ APACHE FINAL OK =) ] ";

cd php-4.3.0
cp php.ini-dist /usr/local/lib/php.ini
cd ..
echo " => [ THE END PHP/Apache/SSL/ModSSL Installed Successfully =)
D1n00z. ] ";


Best Regards Dino.
http://phpopenmonitor.sourceforge.net/

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

[2003-01-16 03:51:46] [EMAIL PROTECTED]

Yes there are always between 5 and 10 childs waiting for connections.

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

[2003-01-15 13:08:41] [EMAIL PROTECTED]

Doe your Webserver allow more then 1 Apache child to be running at any
one time?

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

[2003-01-15 04:30:31] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=21653&edit=1

Reply via email to