Support » Fixing WordPress » Cron not working

  • Resolved perceptionistruth


    I’ve read a few posts with cron issues, but this feels different.

    I upgraded to 2.7, and everything was fine. My web host then switched their load balancing to use squid as a reverse proxy.

    After that, scheduled posts no longer posted, pings no longer get sent out. I installed wp-crontrol and core-control. Through a process of elimination I found that cURL wasn’t working. My web host found an issue with their networking and corrected it, so that now cURL does work.

    However, cron still doesn’t work within WordPress. If I manually execute wp-cron.php?check=<correct hash> then it processes all the outstanding tasks, but if I just leave the site alone, jobs turn up in the cron queue but never get actioned (it certainly gets enough hits) and eventually schedule posts get marked as missed.

    I’m out of ideas. Any help appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve tried increasing the timeout on

    wp_remote_post($cron_url, array(‘timeout’ => 10.01, ‘blocking’ => false));

    in cron.php, and I’ve tried changing it to a wp_remote_get, neither has any effect.

    No matter what I do, wordpress doesn’t process the cron in the background, but I can still get it run by loading wp-cron.php directly.

    The Core Control plugin shows me that cURL is working (to my own blog as well), and using the cron module I try to ‘run now’ the relevant cron jobs but they don’t run then either. So something is happening in or around cron.php which prevents WordPress from trying or managing to load wp-cron.php but I’m struggling to locate what it is.

    Looks like my web hosts squid install is blocking HEAD requests to /wp-cron.php, I’m working with them now to get that resolved.

    Fixed, web host has changed squid config.

    So, if everything seems to be ok, but your cron stuff isn’t working in WordPress, make sure you’re seeing the HEAD requests for wp-cron.php in your log. If you’re not, ask your host if they’re running a reverse squid proxy and if it’s blocking them.

    You can check this yourself with curl, just do a –head request against wp-cron.php and see if you get a 403 Forbidden.

    This is bad,

    curl –head “”
    HTTP/1.0 403 Forbidden
    Server: squid/2.7.STABLE5
    Date: Thu, 08 Jan 2009 16:19:59 GMT
    Content-Type: text/html
    Content-Length: 1126
    X-Squid-Error: ERR_ACCESS_DENIED 0
    Connection: close

    This is good,

    curl –head “”
    HTTP/1.0 200 OK
    Date: Thu, 08 Jan 2009 16:24:04 GMT
    Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b DAV/2 PHP/5.2.6 mod_perl/2.0.4 Perl/v5.8.8
    X-Powered-By: PHP/5.2.6
    Content-Type: text/html
    Connection: close

    My problem was far easier to work out.

    I had the site in Maintenance Mode. And apparently wp-cron stops running in maintenance mode!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cron not working’ is closed to new replies.