title: selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'
body: <p>I'm trying to run <code>PhantomJS</code> from within <code>selenium.webdriver</code> on a Centos server. PhantomJS is in the path and is running properly from terminal. However in the script it appears to be launched, but afterwards cannot be reached on the specified port (I tried 2 different opened ports from my provider 29842 and 60099, they both are not working and neither launching it without a specified port).</p>
  
  <p>The error happens here in <code>selenium.webdriver.common.utils</code>:</p>
  
  <pre><code>try:
      socket_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      socket_.settimeout(1)
      socket_.connect(("localhost", port))
      socket_.close()
      return True
  except socket.error:
      return False
  </code></pre>
  
  <p>This is from my script (I tried without any parameters as well as writing the complete path to the executable and neither worked):</p>
  
  <pre><code>self.browser = webdriver.PhantomJS(
              port=29842,
              desired_capabilities={
                  'javascriptEnabled': True,
                  'platform': 'windows',
                  'browserName': 'Mozilla',
                  'version': '5.0',
                  'phantomjs.page.settings.userAgent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36"
              }
          )
  </code></pre>
  
  <p>And this the script that initialises the webdriver from <code>selenium.webdriver.phantomjs.service</code>. I checked and <code>subprocess.Popen</code> actually lauches phantomjs, the error happens in the while loop:</p>
  
  <pre><code>    try:
          self.process = subprocess.Popen(self.service_args,
                                          stdout=self._log, stderr=self._log)
  
      except Exception as e:
          raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
  
      count = 0
      while not utils.is_connectable(self.port):
          print utils.is_connectable(self.port)
          count += 1
          time.sleep(1)
          if count == 30:
               raise WebDriverException("Can not connect to GhostDriver")
  </code></pre>
  
  <p>All the packages are the latest version: python 2.7, selenium 2 and phantomjs 1.9 binary with ghostdriver integrated. I made the same script work properly on my Ubuntu local machine, doing exactly the same things I did on the server. What is different on the server?</p>