|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10627 bind() fails
Submitted: 2001-05-03 03:12 UTC Modified: 2001-05-28 00:27 UTC
From: old dot wolf at project-w dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.5 OS: Solaris 2.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: old dot wolf at project-w dot com
New email:
PHP Version: OS:


 [2001-05-03 03:12 UTC] old dot wolf at project-w dot com
The sample code on the online documentation fails. Here is a shorter example which fails in the same way:

$s = socket(AF_INET, SOCK_STREAM, 0);
$err = bind($s, "", 44444);
if ($err)

reports: Address family not supported by protocol family.

The same thing happens for other values of address and port, or using protocol 6 instead of 0.

I noticed that it is possible to call listen() without successfully calling bind(), in which case the socket listens correctly on a random port number. (is this intentional?)

I also tried using the undocumented function open_listen_sock() instead (with the CGI version of php invoked from the shell), which works once but then fails on future invocations with the same port number, even though the socket and its accepted sockets were closed properly with close().

My configure line:
./configure --with-mcrypt --with-mhash --with-mysql=../../mysql --with-gd --enable-versioning --with-ttf --enable-debug --enable-shared --enable-freetype-4bit-antialias-hack --with-informix --with-bz2 --with-gmp --with-zlib --with-config-file-path=/usr/local/lib/cgiphp.ini --enable-sockets


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-03 03:23 UTC]
Works for me with latest CVS on Linux just fine.
There have been some fixes in sockets extension since
4.0.5 so please try the latest CVS snapshot from to check if they fix this.


 [2001-05-28 00:27 UTC]
Should be fixed in PHP 4.0.6. Reopen if not.
(4.0.6 will be released soon)


 [2021-04-06 10:40 UTC]
Automatic comment on behalf of roojs
Log: fix bug #10627 - incorrect prototypes
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 11:01:31 2024 UTC