title: How to correctly use PHP to listen for incoming socket connection?
body: <p>I need to create a socket server to listen for some incoming data. I've created a PHP called socketSetup and execute it after page load. The file itself is located in a subdirectory, I need to bind the socket to an address.</p>
  
  <p>Is this possible like this? My main query lies with how I'm binding it... do I just bind it to the main domain or the subdirectory?</p>
  
  <pre><code>$sock = socket_create(AF_INET, SOCK_STREAM, 0);
  
  socket_bind($sock, "http://mydomain.com/mysubdirectory, 80) or die('Could not bind to address');
  </code></pre>
  
  <p>Thanks</p>