Akismet Can't Connect to Server

September 9, 2014 11.9k views

Akismet is reporting "We can’t connect to your site. Your firewall may be blocking us. Please contact your host and refer to our guide about firewalls." This started a couple weeks ago.

When I type sudo ufw status, it says sudo: ufw: command not found.

When I type iptables -L, it says

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

which I guess means I don't have any rules. Akismet says in their docs that they need a TCP connection. I don't know how to give them that. I also don't know what changed two weeks ago as it was working fine before that.

What else can I check? Is there a way to ping Akismet through TCP to make sure that's the issue?

Ubuntu 12.10, Wordpress 4.0, Akismet 3.02


  • Check your php and make sure allow_url_fopen hasnt been disabled. Also if you have any sort of plugin (or in htaccess) that turns your site off line, make sure your site is accessible to the public. I ran into that with jetpack with a site offline plugin.

  • Thanks for the response. allow_url_fopen is set to On. I'm not sure what you mean by 'turns your site off line'. The site is accessible normally, it's just akismet that's not working.

  • Pinging probably isnt going to do any good as that is over ICMP, not TCP. Akismet uses TCP port 80 for connections. If you have telnet on the server you may can try telnet rest.akismet.com 80 which will check your connection to them. If you have a text based browser (such as lynx, not sure what Ubuntu has available) you can probably try to access rest.akismet.com from it.

    On the php, I apologize but I think I told you wrong on that. It used to use allow_url_fopen but now it seems they use fsockopen and gethostbynamel now.

    I am not sure if this will help you or not but here is a page from akismet for connectivity problems... http://docs.akismet.com/general/connection-issues/

    As far as the site offline thing, there are a few plugins that allow you to disable the site for maintenance or what ever. It can also be disabled by htaccess. If the site is disabled then it will have problems with communication which is why I mentioned that.

  • I actually noticed this as well on my server and it appears to have started right around the same time. I'm running CentOS, WordPress 3.9.2 and Akismet 3.01. Nothing's changed on my server (to my knowledge) and calling wget <api_key>.rest.akismet.com:80 returns a 200 OK.

  • I don't have either fsockopenor gethostbyname1inphp.ini. I tried to install telnet, but I can't seem to install it, or update ubuntu, or install fix-missing. That's another issue, but it would be nice.

    I read that akismet page, but it seems to focus on firewalls, which I don't appear to have. That's why I'm trying to focus on the tcp connection. If I don't have a firewall, then digital ocean probably does right? Something has to be keeping the bad stuff out. I think it's some upstream firewall that's blocking it, but then every Wordpress site on DO would be having this problem.

    wgetreturns 200 for me, but I don't know if that uses TCP or not.

  • Yes, wget uses TCP. Dont worry about telnet. Actually if it isnt installed already, dont install it! It is insecure if used for logging in, etc. as it transmits passwords as well as anything else you type in as clear text.

    If your site itself is accessible through a browser without having to type a port behind the domain (i.e. domain.com:8080), then port 80 is not blocked through a firewall. Also considering that you can communicate with akismet through wget, they are also not blocked. With both of these working, it is not a firewall issue. The wget working makes me think it is a PHP configuration issue or something is corrupt. Has PHP been updated or changed somehow around the time you began having issues? Did you do any sort of site update around that time? Is anything else not working correctly?

    On a side note, I would recommend getting a firewall setup on your box. While it may be ok to disable it for testing purposes to rule it out as the cause, it is very insecure to leave a box running without one. I have seen brand new boxes at DCs get setup over night and before we got in the next morning (just a couple hours later) they had been compromised.

  • That's very helpful. Thanks. I didn't know wget used TCP, so I agree it must be a PHP issue. I haven't upgraded PHP, but I upgrade Wordpress whenever a new one comes out. I don't think WP upgrades PHP, but I don't know that for sure.

    Not having touched PHP, it has to be a Wordpress issues. But if that were the case, there would be a lot more people complaining that just me.

    I'll get a firewall set up right away.

  • Even though you havent upgraded PHP, is it possible that it has been upgraded in the background? Not saying that yours is or isnt but have seen this happen.

    As far Wordpress 4.0 and akismet 3.02, I know they work together because I have these both running on one of my own personal sites. They were upgraded from WP 3.9.2 and akismet 3.01 recently and continue to work ok. It is on a CentOS server though. There are also so many differences between similar servers too though that may cause issues for some while it works fine for others.

  • I guess I'll go with the 'corruption' theory. fsockopen and gethostbyname1 both are available. The wget shows that TCP 80 is open to akismet and I don't have any firewall rules. If I have to start from scratch, I'll probably move off DO - too many problems that I can't solve. But maybe I can repair php in place or something. Thanks for the help on this.

  • I still think this is a PHP, WP, or Akismet issue. Have you tried deactivating akismet and deleting it (delete settings and files), then reinstalling it from scratch? Maybe the akismet plugin was corrupted during the update? Make sure you keep a copy of your akismet key handy so you can put it back in if you remove the plugin.

  • I deactivated/reactivated it, but no joy. I didn't try deleting it, so maybe that's a good next step.

  • Just uninstalled and reinstalled with no effect. One reinstalled, it remembered my api key, which I thought was odd. So I uninstalled again and looked around for left over akismet files to delete. There were a few entries in the options table, but not the api key that I could see. Nothing in the plugins folder. I wasn't too confident about deleting anything else.

    So a reinstall didn't work, but I'm not 100% sure I got all of it removed such that no corruption could remain.

  • Yeah that is rather odd. I will have to take a look at mine and see what happens. Did it put the key right back in automatically (like it was still hanging in the site or databases somewhere) or was it where your browser remembered it?

  • Yep. Resinstall, activate, go to the settings page and the key is in the box and the other settings I had (which are not the default) were still there too. Strictness for instance, it remembered, but that's in the wp_options table, so I get that. If API key is in there, I don't know where.

  • Do you use any DNS services like CloudFlare in your setup? Considering those sit between your DO server and Akismet, it could be preventing seemingly malicious activity. In other words, you can get to Akismet, but Akismet can't get to you, because it's being blocked.

2 Answers

Have you tried to check /etc/resolv.conf file configuration? It might be an issue with DNS servers and you can just get timeout for Akismet server.

  • nameserver
  • It is not going to be a resolv issue. If there was a problem with it then any outgoing connection that uses a domain instead of an IP address would fail. This includes the wget command that was issued, any outgoing mail, and trying to do updates on the server and any updates with the site, etc.. The wget command returning an OK result shows (see previous comments) that the server is able to communicate with akismet directly referencing the domain.

  • I just suggested to check those settings. I recently experienced some issues with response time and also had issues with Akismet at the same time. After the file I mentioned in my first reply was modified all response issues were fixed and I also noticed that Akismet started working again.

As currapps said, it is DNS issue .

Have another answer? Share your knowledge.