title: How connect socket.io to php file?
body: <p>I trying to connect to php type file with socket.io because I want to use php and socket.io in my site but if I try this (see code below).
  When I enter to localhost:3000 a file called download is automatically downloading..</p>
  
  <pre><code>var express = require("express");
  var app = express();
  var server = require("http").createServer(app);
  var io = require("socket.io").listen(server);
  
  users = [];
  connections = [];
  
  server.listen(process.env.PORT || 3000);
  console.log("Server running...")
  
  app.get('/', function(req, res){
      res.sendFile(__dirname + "/index.php");
  });
  
  io.sockets.on("connection", function(socket)
  {
      connections.push(socket);
      console.log("Connected: %s sockets connected.", connections.length);
  
      //Disconnect
      socket.on("disconnect", function(data)
      {
          connections.splice(connections.indexOf(socket), 1);
          console.log("Disconnected: %s sockets connected.", 
          connections.length);
      });
  });
  </code></pre>
  
  <p>I really need help because I don't know what I'm doing wrong...
  I want php to build the login/users system and socket.io to have websokets in my site to make stuff.</p>
  
  <p>I know php must use some kind of server like (XAMPP) but it's not helping when when I turn on XAMPP.</p>