Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running 'php -S 127.0.0.1:8080', portfinder will get 8080 not 8081. #9

Closed
helloyou2012 opened this issue Dec 17, 2014 · 6 comments

Comments

@helloyou2012
Copy link

No description provided.

@indexzero
Copy link
Collaborator

I don't understand. You're running php? Then it's probably not a node-related problem.

@thefotios
Copy link

This is a really poorly worded answer. But seeing the letters PHP and running away isn't really a good response either.

That PHP code starts a server listening on port 8080. So what he was trying to say is that it portfinder isn't detecting that port being used for some reason. Here's an example:

Without a PHP server running on port 8080

$ curl -I http://127.0.0.1:8080
curl: (7) Failed connect to 127.0.0.1:8080; Connection refused

$ node -e 'require("portfinder").getPort(function(err,port){console.log(port)});' 
8000

With a PHP server running on 8080

$ curl -I http://127.0.0.1:8080
HTTP/1.1 404 Not Found
Host: 127.0.0.1:8080
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 533

$ node -e 'require("portfinder").getPort(function(err,port){console.log(port)});'
8000

@jcrugzz
Copy link

jcrugzz commented Dec 18, 2014

This also happened here. Could be useful

@Sheraff
Copy link

Sheraff commented Dec 20, 2014

+1 What's the reason behind this?

@indexzero
Copy link
Collaborator

Not sure, let me know when you find out :)

@helloyou2012
Copy link
Author

Thx, I set 'host' option resolved. portfinder.getPort({port: 8080, host: '127.0.0.1' }, function(err, port) { });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants