fsockopen Error

ShannonA

Well-Known Member
#1
I've been running LiteSpeed for a few months now, but just tracked two problems down to something in the LiteSpeed/LSPHP configuration & I'm hoping to get advice.

We're running LS 4.1.4, and all our web sites configurations are generated from our old apache files.

fsockopen

The first problem is that fsockopen seems to no longer be working.

Here's my simple test:


<?

echo gethostbyname('www.paypal.com');
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

echo "!! $errno";
echo "!! $errstr";

?>
And here's my result:

66.211.169.14
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/rpgnet/members/test.phtml on line 4

Warning: fsockopen() [function.fsockopen]: unable to connect to www.paypal.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /var/www/rpgnet/members/test.phtml on line 4
!! 0!! php_network_getaddresses: getaddrinfo failed: Name or service not known
So, name resolution is fine, but for some reason the fsockopen fails.

(The 2nd problem is with Curl, but I just realized it might well be result of fsockopen failing, so I'm saving that for the moment.)

Any ideas?
 

webizen

Well-Known Member
#3
to narrow down the issue, you may hardcode the IP address in fsocketopen and see if it still fails. if not, then it should be sth like DNS or firewall issue other than fsocketopen.
 

ShannonA

Well-Known Member
#4
Somewhat to my surprise, Curl fails:
# curl -I www.paypal.com
curl: (6) Couldn't resolve host 'www.paypal.com'
This worked fine:
$ip = gethostbyname('www.paypal.com');
$fp = fsockopen ($ip, 80, $errno, $errstr, 30);
So DNS generally works
# dig www.paypal.com

; <<>> DiG 9.7.3 <<>> www.paypal.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 18890
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;www.paypal.com. IN A

;; Query time: 1 msec
;; SERVER: 66.211.98.39#53(66.211.98.39)
;; WHEN: Tue Dec 20 18:18:46 2011
;; MSG SIZE rcvd: 32
Apparently curl has lots its DNS somehow. Weird ... Gives me a direction to look in, at least.
 
Top