WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Warning: curl_exec() has been disabled (6 posts)

  1. Sanapaino
    Member
    Posted 5 years ago #

    Hello,

    After upgrading to the Wp 2.7 I get these error messages:

    Warning: curl_exec() has been disabled for security reasons in /home/****/public_html/wp-includes/http.php on line 1022

    Warning: curl_exec() has been disabled for security reasons in /home/****/public_html/wp-includes/http.php on line 102

    Any ideas? I don't even know where to start debugging.

    Edit: Perhaps this should've gone to the "How-To and Troubleshooting" area but well...

  2. MichaelH
    Member
    Posted 5 years ago #

    What does your host say about this?

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

    The underlying problem is that your host has disabled curl, but not all of it, so WordPress detects that it is still enabled and attempts to use it. You can choose a different transport with a little minor code hacking.

    First download this plugin and install it:
    http://trac.wordpress.org/attachment/ticket/8086/list_transports.php?format=raw

    After you activate it, you'll see a list of what transports WordPress detected as working at the bottom of the admin screens (in the footer). Once you know these, you can deactivate and delete the plugin.

    Now, curl will probably be on the list, but you know that one doesn't work already. So pick one of the others and add this code to your theme's functions.php file:

    function block_transport() { return false; }
    add_filter('use_http_extension_transport', 'block_transport');
    add_filter('use_curl_transport', 'block_transport');
    add_filter('use_streams_transport', 'block_transport');
    add_filter('use_fopen_transport', 'block_transport');
    add_filter('use_fsockopen_transport', 'block_transport');

    That will block all five possible transports from working. Now just remove the add_filter line on the transport that you want WordPress to actually use.

  4. Sanapaino
    Member
    Posted 5 years ago #

    @MichaelH: Host says nothing (yet).

    @Otto42: Thank you, thank you, thank you.

    Small typo in your example. I wrote this to my functions.php:

    function block_transport() { return false; }
    add_filter('use_curl_transport', 'block_transport');

    This worked for me even though it feels more like a batch than a resolution. Your mileage may vary.

    But I do not understand the changes in WP. Earlier versions worked like a charm.

    Now I'm off to yell at my host...

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

    Thanks for the heads up, typo corrected.

    But I do not understand the changes in WP. Earlier versions worked like a charm.

    Earlier versions used the fsockopen transport exclusively. If that didn't work on your host, you were out of luck.

    WordPress 2.7 adds a new HTTP API, which allows five different methods for it to try to use on any http request. It tests what's available and uses the first one it finds enabled. This allows the http functionality to work on many, many more hosting services.

    Unfortunately, nobody reported this particular curl issue during the betas, so nobody saw it coming. I've made a trac ticket, it'll probably get fixed in the next minor release. For now, this sort of quick fix works.

  6. Sanapaino
    Member
    Posted 5 years ago #

    Thanks for the details.

Topic Closed

This topic has been closed to new replies.

About this Topic