WordPress.org

Ready to get started?Download WordPress

Forums

What to do if fsockopen is blocked to port 80? (5 posts)

  1. mr.omneo
    Member
    Posted 5 years ago #

    I'm probably joining this query late in the game, I've spent the afternoon reading thread upon thread trying to get to the bottom of why scheduled posts won't work.

    I subsequently found out that my host blocks fsockopen to port 80 for security and won't unblock it for individual sites. they do allow me to put in a command to run my own cron scripts but I have no idea what i should be putting in there.

    Can anyone help me out? Is there a workaround to get call wp-cron.php using my hosts scheduler or some other way to get pingbacks and scheduled posts to work.

    many thanks in advance.

    Mr O

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Well, I'd find a different host personally, since several things about WordPress won't work if they don't allow outside HTTP connections... but you can indeed make the wp-cron scheduler work based on a real cron job.

    1. Make a copy of wp-cron.php and rename it to something else. Don't tell anybody else what the name is, it needs to be relatively secret, to prevent denial of service attacks. This is normally prevented anyway, but we're going to remove that. So let's say you call it example.php.

    2. Edit the example.php file, and remove these lines:

    if ( $_GET['check'] != wp_hash('187425') )
    	exit;

    That eliminates the check which prevents systems other than your own WordPress install from executing the wp-cron process. This allows you to execute it from anywhere, including a normal cron job.

    3. Make a normal cron job to execute your example.php file. Your host can help you with this, but generally you'll make a wget call to your server to make it run, or something similar. You'll have to consult your host for this info. You want it to run your example.php file on some sort of regular basis, basically.

  3. mr.omneo
    Member
    Posted 5 years ago #

    Hi Otto,

    I tried your suggestion but judging by the result of the email I got after the CRON job ran, it didn't like something. The start of the message was:

    WordPress database error MySQL server has gone away for query SELECT * FROM wp_posts, wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_pingme' LIMIT 1 made by do_all_pings
    WordPress database error MySQL server has gone away for query SELECT * FROM wp_posts, wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_encloseme' LIMIT 1 made by do_all_pings
    WordPress database error MySQL server has gone away for query SELECT ID FROM wp_posts WHERE to_ping <> '' AND post_status = 'publish' made by do_all_pings

    And then lots of entries very similar to this:

    WordPress database error MySQL server has gone away for query UPDATE wp_options SET option_value = 'a:98:{i:1209252233;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209252259;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209253831;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209253918;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209337149;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209337172;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\";b:0;s:4:\"args\";a:0:{}}}}i:1209337188;a:1:{s:8:\"do_pings\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:2:{s:8:\"schedule\"!

    Any idea what that might mean?

    Thanks again

    Mr O

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    You have a lot of posts trying to "do_pings", which require, again, that they connect outside the system on port 80.

    Like I said, lots of things won't work.

    You can eliminate all the waiting wp-cron jobs by using the WP-Crontrol plugin.

  5. mr.omneo
    Member
    Posted 5 years ago #

    Thanks for such a speedy response, I'll check out that plugin now and hopefully won't have to bother you further :)

Topic Closed

This topic has been closed to new replies.

About this Topic