cornernote
cornernote

Reputation: 1095

PHP fsockopen() fails, but telnet works

I am trying to get Sphinx Search working under Windows7. So far everything is great except PHP cannot connect to the running service.

ONLY TELNET WORKS:

telnet localhost 3312

php: fsockopen("localhost", 3312, $errno, $errstr, 30);

I decided to test some other ports...

BOTH WORK:

telnet localhost 80

php: fsockopen("localhost", 80, $errno, $errstr, 30);

ONLY TELNET WORKS:

telnet localhost 3306

php: fsockopen("localhost", 3306, $errno, $errstr, 30);

Could the reason have something to do with the port being binary data on 3312 and 3306?

Upvotes: 2

Views: 2795

Answers (1)

HiTCHO
HiTCHO

Reputation: 84

Try and use 127.0.0.1 instead of localhost - many times this could show up dependency on the OS to do lookup on the hostname for you. If this works then it isn't PHP it is a linkage between PHP and OS.

Upvotes: 2

Related Questions