title: socket_bind(): unable to bind address [99] (Ubuntu on Amazon EC2)
body: <p>I'm trying to use Sockets on an EC2 Instance, but when I try to run the code I get the following error:</p>
  
  <blockquote>
    <p>PHP Warning:  socket_bind(): unable to bind address [99]: Cannot
    assign requested address in sockets_test.php on line 45</p>
  </blockquote>
  
  <p>Here is part of the relevant code:    </p>
  
  <pre><code>$CFG = new stdClass();
  $CFG-&gt;chat_serverip = 'MY_PUBLIC_EC2_IP';
  $CFG-&gt;chat_serverport = '9111';
  
  $listen_socket = socket_create(AF_INET, SOCK_STREAM, 0))
  socket_bind($listen_socket, $CFG-&gt;chat_serverip, $CFG-&gt;chat_serverport)
  </code></pre>
  
  <p>This works just fine if I use 127.0.0.1 or the Private IP. 
  My Security Group has the the rules:</p>
  
  <pre><code>0-65535 0.0.0.0/0 (TCP)
  0-65535 0.0.0.0/0 (UDP)
  ALL 0.0.0.0/0 (ICMP)
  </code></pre>