Error: cURL error 7

You are getting the following error  when you go to check your WordPress performance under site health analyze :

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: Failed to connect to localhost port 8080: Connection refused (http_request_failed)

You also may have errors as :

  • Background updates.
  • Your site could not complete loopback request

How to resolve it

The curl error is very explicit: It means “Failed to connect() to host or proxy.

You may have a firewall on your server or your localhost computer if WordPress is on your localhost. Check if port 80 and 443 are blocked, or check your personal firewall.

Sometimes, Curl will use the post 8080 instead of the classic port 80. So you also should be sure that you server uses the port 80 on your server settings.

Also, you should look at your security plugin if you have one enabled. Try to disable it.

If this curl problem causes others problems like page & post updating, then you should follow this process:

  • Create a backup of FTP files and database
  • Disable all plugins
  • Switch to the default theme
  • Clear the cache of your plugins, your browser, your hosting and your CDN if you have one.
  • Rename your .htaccess file (by .htaccess.old for example). Go to the permalinks settings page, and click on save (it will flush permalinks).
  • If it doesn’t work, try to change tour permalinks from “Month and name” to “Plain”.

Leave a Comment

Your email address will not be published.

You may also like