[wp-hackers] ALTERNATE_WP_CRON... Is it worth it?

Nicola Peluchetti nicola.peluchetti at gmail.com
Thu Oct 18 20:20:59 UTC 2012

> For the very specific case of the following error:
> Warning: fopen(http://localhost/wp/wp-cron.php?doing_wp_cron)
> [function.fopen]: failed to open stream: HTTP request failed!
> One option to fix it, is to disable the faulty HTTP transport which
> isn't doing it's job on the server (usually it's caused by a bad
> configuration, but some linux distro PHP builds are known to cause it
> as well) by adding the following in a mu-plugin (or the theme
> functions.php I guess)
> add_filter( 'use_streams_transport', '__return_false' );
> It has the downside that it may stop ALL outgoing requests if the
> server doesn't support cURL and fsockopen also doesn't work - but
> usually at least one of these is available on the server..
> I usually suggest hitting the Plugin install page, if you can search
> for a plugin after adding the above, all your problems should
> hopefully disappear.. if you can't browse plugins, you'll have to
> remove the above line of code and curse at the server again..
This specific error happens ( if i'm not right correct me ) on every CRON
run when cUrl is disabled. This is because the class WP_Http_Streams
doesn't support a timeout of 0.01 seconds, which is what's used by the
standard CRON.
So if there is no cUrl installed all CRON jobs are destined to fail (
silently, as Wordpress silence all errors ). For this reason i wrote a note
on this trac
http://core.trac.wordpress.org/ticket/18738?cversion=0&cnum_hist=9 hoping
they put transports in the right order.
I'm a developer of a widespread plugin and i need crons to be working for
the correct behaviour of the plugin, would you see a lot of risk in
disabling streams if no cUrl is present ( cUrl is the first transport and
it works with a 0.01 timeout ).

More information about the wp-hackers mailing list