Support » Fixing WordPress » Error: [] cURL error 7:

  • Hello

    I installed WP in a VM at home to perform some tests.
    Everything was working well, I can access to website from internet, etc…
    But when I go to “Tools > Site Health”, I have 3 Critical issues. All of them related to a “cURL error 7”, but without any details related to which error.

    The REST API encountered an error
    The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.

    The REST API request failed due to an error.
    Error: [] cURL error 7:

    Could not reach WordPress.org
    Communicating with the WordPress servers is used to check for new versions, and to both install and update WordPress core, themes or plugins.

    Error Your site is unable to reach WordPress.org at 198.143.164.251, and returned the error: cURL error 7:

    Your site could not complete a loopback request
    Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.

    The loopback request to your site failed, this means features relying on them are not currently working as expected.
    Error: [] cURL error 7:

    When I connect to Unix hosting WP, I’m able to perform a cURL to WordPress, and reach internet.
    I can’t find what is going on and how to fix it, since there is no error details, neither in WP logs.

    Any tips ?

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter skipwoof

    (@skipwoof)

    
    ### wp-core ###
    
    version: 5.2.3
    site_language: en_US
    user_language: en_US
    permalink: /%postname%/
    https_status: true
    user_registration: 0
    default_comment_status: open
    multisite: false
    user_count: 1
    dotorg_communication: cURL error 7: 
    
    ### wp-paths-sizes ###
    
    wordpress_path: /var/www/html/wordpress
    wordpress_size: 37.36 MB (39176082 bytes)
    uploads_path: /var/www/html/wordpress/wp-content/uploads
    uploads_size: 1.95 MB (2049885 bytes)
    themes_path: /var/www/html/wordpress/wp-content/themes
    themes_size: 3.06 MB (3208811 bytes)
    plugins_path: /var/www/html/wordpress/wp-content/plugins
    plugins_size: 1.90 MB (1992673 bytes)
    database_size: 656.00 KB (671744 bytes)
    total_size: 44.92 MB (47099195 bytes)
    
    ### wp-active-theme ###
    
    name: Twenty Nineteen
    version: 1.4
    author: the WordPress team
    author_website: https://wordpress.org/
    parent_theme: none
    theme_features: automatic-feed-links, title-tag, post-thumbnails, menus, html5, custom-logo, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-style, editor-font-sizes, editor-color-palette, responsive-embeds, widgets
    theme_path: /var/www/html/wordpress/wp-content/themes/twentynineteen
    
    ### wp-themes (2) ###
    
    Twenty Seventeen: version: 2.2, author: the WordPress team
    Twenty Sixteen: version: 2.0, author: the WordPress team
    
    ### wp-plugins-active (3) ###
    
    cURL no IPv6: version: 1.0, author: GOLDERWEB – Jonathan Golder
    Site Offline: version: 1.3.8, author: Chandra Shekhar Sahu
    SSL Insecure Content Fixer: version: 2.7.2, author: WebAware
    
    ### wp-plugins-inactive (2) ###
    
    Akismet Anti-Spam: version: 4.1.2, author: Automattic
    Hello Dolly: version: 1.7.2, author: Matt Mullenweg
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_GD
    imagick_module_version: Not available
    imagemagick_version: Not available
    gd_version: 2.2.5
    ghostscript_version: not available
    
    ### wp-server ###
    
    server_architecture: Linux 4.18.0-80.11.2.el8_0.x86_64 x86_64
    httpd_software: Apache/2.4.37 (centos) OpenSSL/1.1.1 mod_fcgid/2.3.9
    php_version: 7.4.0RC4 64bit
    php_sapi: fpm-fcgi
    max_input_variables: 1000
    time_limit: 30
    memory_limit: 256M
    max_input_time: 60
    upload_max_size: 2M
    php_post_max_size: 8M
    curl_version: 7.61.1 OpenSSL/1.1.1
    suhosin: false
    imagick_availability: false
    htaccess_extra_rules: true
    
    ### wp-database ###
    
    extension: mysqli
    server_version: 5.5.5-10.3.11-MariaDB
    client_version: mysqlnd 7.4.0RC4
    
    ### wp-constants ###
    
    WP_HOME: undefined
    WP_SITEURL: undefined
    WP_CONTENT_DIR: /var/www/html/wordpress/wp-content
    WP_PLUGIN_DIR: /var/www/html/wordpress/wp-content/plugins
    WP_MAX_MEMORY_LIMIT: 256M
    WP_DEBUG: false
    WP_DEBUG_DISPLAY: true
    WP_DEBUG_LOG: false
    SCRIPT_DEBUG: false
    WP_CACHE: false
    CONCATENATE_SCRIPTS: undefined
    COMPRESS_SCRIPTS: undefined
    COMPRESS_CSS: undefined
    WP_LOCAL_DEV: undefined
    
    ### wp-filesystem ###
    
    wordpress: writable
    wp-content: writable
    uploads: writable
    plugins: writable
    themes: writable
    
    
    Dion

    (@diondesigns)

    Makr sure your system/firewall is configured to allow your localhost setup to send/receive on ports 80 and 443.

    Thread Starter skipwoof

    (@skipwoof)

    It’s already the case. Otherwise how could I reach the website on both port 80 and 443 ? As I said in my first post “When I connect to Unix hosting WP, I’m able to perform a cURL to WordPress, and reach internet.” + “I can access to website from internet,” 😉
    And my firewalld is disabled/stopped on system side.
    So the issue is not here…
    Any tips to find what’s going on ?

    • This reply was modified 2 years, 11 months ago by skipwoof.
    • This reply was modified 2 years, 11 months ago by skipwoof.
    Dion

    (@diondesigns)

    You said the problem is on a VM at home, not on the unix hosting. Check the firewall on your VM at home.

    Curl error 7 means Curl was blocked from accessing the requested site. Since wordpress.org has no blocks (that I’m aware of, anyway), that error is almost always caused by firewall issues on the local system making the request.

    Thread Starter skipwoof

    (@skipwoof)

    Local Firewall is disabled, nothing else can block flows.
    I’ve a firewall in my home network, and even with an ANY ANY ACCEPT rule, issue still persist. And I see no drops in logs.
    I don’t think issue is on Firewall side.
    The question is : why do we only have error message “Error: [] cURL error 7:” whith nothing else ?? Usually it says what’s wrong.. it’s more detailed…

    Thread Starter skipwoof

    (@skipwoof)

    Nobody can help ? No tips ?
    I ran a TCPDUMP to check if something were wrong, but found nothing strange :/

    I have the same error message in health check – did you get any resolution to your issue?
    I’m running WordPress locally via Lando/Docker

    Thread Starter skipwoof

    (@skipwoof)

    No. Couldn’t find anything on the web, and no clue on log files. So maybe a WordPress bug, or an issue on FileSystem.
    I ended by a full clean install in a whole New VM.

    Can you ssh into your server and perform a curl -v https://localhost?

    If you are using SELinux (Security-Enhanced Linux), it has a default setting that blocks HTTP servers from making network connections. For example I’m using CentOS 8 and couldn’t figure out why my server couldn’t connect but whenever I logged in I was able to.

    This will allow connections to be made:

    sudo setsebool -P httpd_can_network_connect true

    After this you may need to restart your service.

    This might be your issue if you’re able to “curl” and “ping” without problem as a user, but your webserver (Apache, Nginx, etc) isn’t able to.

    • This reply was modified 2 years, 5 months ago by igienger. Reason: Code formatting

    Thanks @igienger it made me revisit this issue again.

    I don’t know whether the Site Health feature has now been improved in WP 5.4, but the error message I now see is:

    The REST API request failed due to an error.
    Error: cURL error 7: Failed to connect to mywebsite.lndo.site port 443: Connection refused (http_request_failed)

    And for the original question:

    Can you ssh into your server and perform a curl -v https://localhost?

    ❯ curl -v https://localhost
    *   Trying ::1...
    * TCP_NODELAY set
    * Connected to localhost (::1) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    * TLSv1.2 (OUT), TLS alert, unknown CA (560):
    * <strong>SSL certificate problem: unable to get local issuer certificate</strong>
    * Closing connection 0
    curl: (60) SSL certificate problem: unable to get local issuer certificate
    More details here: https://curl.haxx.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the web page mentioned above.

    So as the SSL cert is not working properly on my local setup then that is why health check is failing.

    I tried your command:

    sudo setsebool -P httpd_can_network_connect true

    but the command was not found. Running it in the Lando instance was accepted:

    lando setsebool -P httpd_can_network_connect true

    But it didn’t have any affect.

    • This reply was modified 2 years, 5 months ago by James. Reason: obfuscation of URL

    Any solution to this?
    @bonkerz you have been using lando and I haven’t seen you posting any more issue, did you solve this arleady.

    I am using the news lando with Docker 2.3.0.3 on windows and every setup ngnix and apache, php 7.3 & 7.4 all work fine but have this issue.

    For me it’s a show stopper since it stops plugins from working.

    @benhadad I’m not sure what happened but its not showing as an error anymore. I’d recommend getting latest WP, latest Lando, running a lando rebuild.
    Even with the error, this error never stopped me from installing plugins like you are experiencing, so that sounds like a different issue to me.

    If you are using SELinux (Security-Enhanced Linux), it has a default setting that blocks HTTP servers from making network connections. For example I’m using CentOS 8 and couldn’t figure out why my server couldn’t connect but whenever I logged in I was able to.

    This will allow connections to be made:

    sudo setsebool -P httpd_can_network_connect true

    After this you may need to restart your service.

    This might be your issue if you’re able to “curl” and “ping” without problem as a user, but your webserver (Apache, Nginx, etc) isn’t able to.

    This solved my issue. Much more to learn about CentOS. Thanks @igienger!

    • This reply was modified 1 year, 10 months ago by spacecadet404. Reason: Forgot to credit solution

    I have a similar issue. I don’t know if you lot have a similar cause.

    I’m pretty sure for me it’s because my WP install is on a docker container that sits behind a reverse proxy. The curl requests are to the website domain and that domain resolves to localhost. The localhost container doesn’t deal with HTTPS as that’s the job of the reserve proxy.

    I haven’t found a solution yet :/

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Error: [] cURL error 7:’ is closed to new replies.