PHP 4.0 Bug #7471 Updated: fsockopen() fails to open a connection using a hostname

From: Date: Sun, 29 Oct 2000 00:42:51 +0000
Subject: PHP 4.0 Bug #7471 Updated: fsockopen() fails to open a connection using a hostname
Groups: php.dev 
Request: Send a blank email to php-dev+get-36283@lists.php.net to get a copy of this message
ID: 7471 User Update by: tom@minnesota.com Status: Open Bug Type: Sockets related Description: fsockopen() fails to open a connection using a hostname that was on NetBSD/Alpha 1.5_BETA. Perhaps these lines from config.log may help: /usr/include/sys/socket.h:186: syntax error before `u_char' /usr/include/sys/socket.h:214: syntax error before `u_char' /usr/include/sys/socket.h:216: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:216: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:216: size of array `__ss_pad1' is negative /usr/include/sys/socket.h:217: syntax error before `int64_t' /usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:273: syntax error before `uid_t' /usr/include/sys/socket.h:278: syntax error before `gid_t' /usr/include/sys/socket.h:452: syntax error before `u_short' /usr/include/sys/socket.h:460: syntax error before `caddr_t' /usr/include/sys/socket.h:464: syntax error before `caddr_t' /usr/include/sys/socket.h:485: syntax error before `recv' /usr/include/sys/socket.h:485: syntax error before `size_t' /usr/include/sys/socket.h:485: warning: data definition has no type or storage class /usr/include/sys/socket.h:486: syntax error before `recvfrom' /usr/include/sys/socket.h:486: syntax error before `size_t' /usr/include/sys/socket.h:487: warning: data definition has no type or storage class /usr/include/sys/socket.h:488: syntax error before `recvmsg' /usr/include/sys/socket.h:488: warning: data definition has no type or storage class /usr/include/sys/socket.h:489: syntax error before `send' /usr/include/sys/socket.h:489: syntax error before `size_t' /usr/include/sys/socket.h:489: warning: data definition has no type or storage class /usr/include/sys/socket.h:490: syntax error before `sendto' /usr/include/sys/socket.h:491: syntax error before `size_t' /usr/include/sys/socket.h:491: warning: data definition has no type or storage class /usr/include/sys/socket.h:492: syntax error before `sendmsg' /usr/include/sys/socket.h:492: warning: data definition has no type or storage class In file included from configure:6052: /usr/include/netinet/in.h:124: syntax error before `u_int32_t' /usr/include/netinet/in.h:196: syntax error before `u_int8_t' /usr/include/netinet/in.h:200: syntax error before `int8_t' /usr/include/netinet/in.h:214: syntax error before `int8_t' In file included from /usr/include/netinet/in.h:376, from configure:6052: /usr/include/netinet6/in6.h:120: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:142: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:147: syntax error before `u_int32_t' /usr/include/netinet6/in6.h:594: syntax error before `*' /usr/include/netinet6/in6.h:596: syntax error before `*' /usr/include/netinet6/in6.h:596: warning: data definition has no type or storage class /usr/include/netinet6/in6.h:597: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:598: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:600: syntax error before `inet6_rthdr_space' /usr/include/netinet6/in6.h:600: warning: data definition has no type or storage class configure: failed program was: #line 6050 "configure" #include "confdefs.h" #include <sys/socket.h> #include <netinet/in.h> int main() { struct sockaddr_in6 s; s; ; return 0; } Previous Comments: --------------------------------------------------------------------------- [2000-10-25 22:42:09] tom@minnesota.com Demonstration that fsockopen() DOESN'T works using FQDN. First I'll verify that my DNS works. This should eliminate the blame on DNS: # ping -c 5 www.php.net PING www.php.net (208.247.106.187): 48 data bytes 64 bytes from 208.247.106.187: icmp_seq=0 ttl=244 time=78.557 ms 64 bytes from 208.247.106.187: icmp_seq=1 ttl=244 time=69.776 ms 64 bytes from 208.247.106.187: icmp_seq=2 ttl=244 time=71.729 ms 64 bytes from 208.247.106.187: icmp_seq=3 ttl=244 time=67.823 ms 64 bytes from 208.247.106.187: icmp_seq=4 ttl=244 time=68.800 ms ----www.php.net PING Statistics---- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 67.823/71.337/78.557/4.287 ms ---cut--- <?php $fp = fsockopen ("www.php.net", 80, &$errno, &$errstr, 30); if (!$fp) { echo "Unable to open a socket using fsockopen<br>n"; echo "$errstr ($errno)<br>n"; } else { fputs ($fp, "GET / HTTP/1.0rnrn"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> ---cut--- Demonstration that fopen() works using FQDN. ---cut--- <?php $fp = fopen ("http://www.php.net/", "r"); if (!$fp) { echo "Unable to open a socket using fopen()<br>n"; echo "$errstr ($errno)<br>n"; } else { while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> ---cut--- Demonstration that fsockopen() does works using IP address. ---cut--- <?php $fp = fsockopen ("208.247.106.187", 80, &$errno, &$errstr, 30); if (!$fp) { echo "Unable to open a socket using fsockopen<br>n"; echo "$errstr ($errno)<br>n"; } else { fputs ($fp, "GET / HTTP/1.0rnrn"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> ---cut--- --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7471

« previous php.dev (#36283) next »