ID:               40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:      playercd8 at hotmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Network related
 Operating System: FreeBSD5.5
 PHP Version:      5.2.0
 New Comment:

Because, is PHP Version too new ?

use 
<?php
phpinfo();
?>

-------------------------------------
OS = FreeBSD 5.5
PHP Version 5.2.0

Configure Command=
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local'
'--enable-reflection' '--enable-spl' '--program-prefix='
'--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
'--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local'

PHP API         = 20041225
PHP Extension   = 20060613
Zend Extension  = 220060519 

but, Sockets Support =  enabled ? why?

---------------------------------------------------
OS = Fedora Core 6
PHP Version 5.1.6

Configure Command =
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux'
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--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' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr'
'--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
'--enable-yp' '--enable-wddx' '--with-kerberos'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar'
'--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
'--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC'
'--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

PHP API         = 20041225
PHP Extension   = 20050922
Zend Extension  = 220051025

Sockets Support = enabled


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

[2007-01-19 09:39:02] playercd8 at hotmail dot com

are your answer like "PHP5 can not sure to use fsockopen at FreeBSD"?

is fsockopen not support at FreeBSD, now?

or, you are remove PHP5 able use at FreeBSD?

It's Bug? or not bug?

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

[2007-01-19 08:07:53] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.



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

[2007-01-19 04:25:18] playercd8 at hotmail dot com

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?

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

[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
---------------------------------------------

        function HttpRequest( $url, $method = "GET", $data = NULL,
$additional_headers = NULL, $followRedirects = true )

        {

        # in compliance with the RFC 2616 post data will not redirected

            $method = strtoupper($method);

        $url_parsed = @parse_url($url);

            if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

        extract($url_parsed);

                

                $data_get = NULL;

            if(is_array($data))

        {

        $ampersand = '';

                $temp = NULL;

                        foreach($data as $k => $v)

                {

                                if ($k != "0")

                                {

                                $temp .= 
$ampersand.urlencode($k).'='.urlencode($v);

                                        $ampersand = '&';

                                }

                        }

                        $data_get = $temp;

                }

                if([EMAIL PROTECTED])

                {

                        if ($scheme == "https")

                                $port = 443;

                        else

                                $port = 80;

                }

                if([EMAIL PROTECTED]) $path = '/';

                if(($method == "GET") and (@$data_get)) $path .= "?".$data_get;

                
                #debug  
                if ($this->debug == true)       echo $path;     
        

                $out = "$method $path {$_SERVER['SERVER_PROTOCOL']}\r\n";

                $out .= "Host: $host\r\n";


                if($method == 'POST')

                {

                        $out .= "Content-type: 
application/x-www-form-urlencoded\r\n";

                        $out .= "Content-length: " . @strlen($data_get) . 
"\r\n";

                }

                $out .= (@$additional_headers)?$additional_headers:'';

                $out .= "Connection: Close\r\n\r\n";

                if($method == "POST") $out .= $data_get."\r\n";

                #debug
                if ($this->debug == true)       echo $out;
                
                #fix https

                $openhost = ($scheme == "https" ? "ssl://" : "").$host;

                #debug

                if ($this->debug == true)       echo
"OpenSocket:".$openhost."(".$port.")";


                if(!$fp = @fsockopen($openhost, $port, $errno, $errstr, 15))

                {
                        #debug

                        if ($this->debug == true)       echo "Now can not open
socket.\nError($errno) $errstr\n";


                        return false;

                }

                fwrite($fp, $out);

                

                while (!feof($fp))

                {

                        $s = fgets($fp, 128);


                        #debug

                        if ($this->debug == true)       echo "\n".$s;

                        

                        if ( $s == "\r\n" )

                        {

                                $foundBody = true;

                                continue;

                        }

                        if ( $foundBody )

                        {

                                $body .= $s;

                        } else {

            

                                #echo $s;

            

                                if( ($followRedirects) and 
(preg_match('/^Location:(.*)/i', $s,
$matches) != false) )

                                {

                                        fclose($fp);

                                        if (strpos(trim($matches[1]), 'http') 
=== false)

                                        {

                                                $urlTo = trim($matches[1]);

                                                $urlLocation = ($scheme == 
'https' ? 'https://' :
'http://').($host).(substr($urlTo, 0, 1) == '/' ? '' : '/').($urlTo);

                                                return $this->HttpRequest( 
$urlLocation );

                                        }

                                        else

                                                return $this->HttpRequest( 
trim($matches[1]) );

                                }

                                $header .= $s;

                                
if(preg_match('@HTTP[/]1[.][01x][\s]{1,}([1-5][01][0-9])[\s].*$@',
$s, $matches))

                                {

                                        $status = trim($matches[1]);

                                }

                        }

                }

                fclose($fp);

                return array('head' => trim($header), 'body' => trim($body), 
'status'
=> $status);

        }

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

[2007-01-17 10:01:48] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.




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

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/40151

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

Reply via email to