View Single Post
  #1 (permalink)  
Old 07-06-2009, 08:43 PM
WindyT WindyT is offline
Registered User
 
Join Date: Nov 2004
Posts: 36
WindyT is on a distinguished road
fsockopen won't connect on port 80 to akismet

The server hasn't been connecting to akismet to verify api keys in quite a while. We've helped the clients by hard coding the keys in, which works but it's a kludge. We suspect the slowness in the multiple wordpress blogs on our server has to do with interfacing with akismet.com, and rest.akismet.com

Naturally, I suspected the firewall, and messing with the allowed IPs didn't do the trick. Turning off the firewall didn't do the trick. (I'm using Chirpy's ConfigServer Firewall, and thanks Chirpy!)

I've done a bit of searching here and on the Wordpress forums, but most searches come up with the issue, but not the solution, which I'm asking here.

It seems that fsockopen isn't connecting. I found a bit of code to test, and here's what I'm using on my personal site on the server:

Code:
<?php
$fp = fsockopen("rest.akismet.com", 80, $errno, $errstr, 30);
if (!$fp) {
        echo "$errstr ($errno)<br />\n";
} else {
        $out = "GET / HTTP/1.1\r\n";
        $out .= "Host: rest.akismet.com\r\n";
        $out .= "Connection: Close\r\n\r\n";
 
        fwrite($fp, $out);
        while (!feof($fp)) {
                echo fgets($fp, 128);
        }
        fclose($fp);
}
?>
and the resulting error from the webpage after it times out:
Code:
Warning: fsockopen() [function.fsockopen]: unable to connect to rest.akismet.com:80 (Connection timed out) in /home/mysite/public_html/testakismet.php on line 2
Connection timed out (110)
The page doesn't throw any errors in the apache logs.

I read somewhere I might have to allow the akismet URL in the
/etc/resolv.conf
but read somewhere else I have to make this resolv.conf available to the
/home
directory so normal webpage calls can use it.

Is this a CPanel issue? A CentOS issue, or a Linux/apache security issue?


---

Details on my server that has about 90 accounts on it:

Code:
cPanel 11.24.4-R36167 - WHM 11.24.2 - X 3.9
CENTOS 5.3 x86_64 standard on srv02
Server Version: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9
knl: 2.6.18-128.1.16.el5 #1 SMP Tue Jun 30 06:07:26 EDT 2009 x86_64
Reply With Quote