|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32363 socket_bind can't bind
Submitted: 2005-03-18 17:36 UTC Modified: 2005-03-18 19:11 UTC
From: motion_4u at hotmail dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.0.3 OS: Apache 2 on win2k
Private report: No CVE-ID: None
 [2005-03-18 17:36 UTC] motion_4u at hotmail dot com
socket_bind() function on Apache2/ Win2k can't bind

Reproduce code:
//"daemon" in UDP
$socketD = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); 

if($socketD === FALSE) { // something went wrong
       echo 'socket_create failed: '.socket_strerror(socket_last_error())."\n";
   This is the second option but still doesn't work
   if(!socket_bind($socketD, "", 27123)) 
   if(!socket_bind ($socketD, 0, $port))
   echo 'socket_bind failed: '.socket_strerror(socket_last_error())."\n";

Expected result:
This is the PHP error message:
Warning: socket_bind() [function.socket-bind]: unable to bind address [0];

I realy dug into the documentations and examples and find it hard to believe that I do something wrong. The warning message explains that the socket it already binded and cannot be used twice :((


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-18 19:11 UTC]
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 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.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 07:03:34 2022 UTC