Bobcares

Try our smart search search

Are you frustrated with “cURL error 7 failed to connect to port 443”? This error is common when using PayPal or Facebook login scripts on the website. This mainly occurs when the server firewall blocks the curl request. Today, let’s discuss the error in detail and see how our Support Engineers fix it for our customers. At Bobcares, we often receive requests to fix this error as part of our Server Management Services.

Overview
  1. What is cURL error 7?
  2. Common Causes Behind the Error
  3. Troubleshooting Tips

What is cURL error 7?

Curl error 7 mainly occurs when the TCP connection to a given host/port fails. It ends up in an error message.

PHP Fatal error: Uncaught exception 'Exception' with message 'cURL error: [7] Failed to connect to xxx.paypal.com port 443: Connection refused'Copy Code

Let’s discuss the details of the exact scenario of the error.

A Sample Case

Recently, one of our WordPress customers approached us with a request stating:

I have installed a theme on my site, however, the theme won’t validate. I’ve installed a Query Monitor and saw that I’m receiving a cURL 7 error. Could you please help me resolve this issue?

cURL error 7 failed to connect to port 443

On checking the error, our Support engineers ensured that no firewall was blocking outbound connection in this server. Also, we found port 443 opened in TCP In/Out and UDP Out for both IPv4 and IPv6.

How we Fixed It?

Recently when one of our customers ran into this error, our Support Engineers helped them out in no time. Our Support Engineers tried to issue a telnet session to the host server and found some connection errors.

Upon checking, we found that the customer’s IP has been blocked in the WordPress theme update server. And, that is this error was occurring. We asked the customer to contact WordPress to whitelist the IP in their firewall. This resolved the error and the theme activation worked fine.

Common Causes Behind the Error

Now. let’s take a look at some of the common causes behind this error:

1. PayPal script: In case we are using PayPal on our website, our experts recommend taking a closer look. One way to check if the PayPal script is the root cause behind the error would be to remove the script and check if the error persists.

2. Facebook login script: In some cases, the error is due to the server firewall blocking the curl request. Additionally, this also results in a blocked IP address preventing the validation of a theme after installation. We are likely to run into this error when the curl request is not on the standard port.

3. Server Unreachable: There may be a network problem or the server may be unavailable.

4. Firewall or Security Software: Outgoing connections on port 443 may be blocked by firewalls, antivirus programs, or other security software.

5. DNS Resolution Problems: It’s possible that the domain name isn’t correctly resolving to an IP address.

6. Network Configuration: Incorrect client-side network configuration might obstruct a connection.

7. Proxy Settings: The connection attempt may fail if a proxy is needed but is not set up correctly or if there are proxy-related problems.

8. SSL/TLS Configuration: Although they often result in distinct cURL error codes, issues with SSL/TLS configuration can also lead to connection failures.

Troubleshooting Tips

Here are a few troubleshooting tips to avoid cURL error 7:

1. Upgrade the PHP to the latest version.

2. Then, disable all plugins and activate them one at a time to check when the error pops up.

3. Alternatively, we can switch back to the default WordPress theme and check if the error still appears or not.

4. Check if the server is up using tools like ping, traceroute, or websites like “Is It Down Right Now.”

5. Ensure the internet connection is active by accessing other websites or services.

6. Check if the firewall or security software is blocking connections on port 443. Temporarily disable them to test.

7. Use nslookup or dig to ensure the domain resolves correctly:

nslookup example.com
dig example.comCopy Code

8. Verify the network settings for any misconfigurations or restrictions.

9. If using a proxy, configure cURL to use it:

curl -x http://proxyserver:port https://example.com

If not using a proxy, ensure no proxy settings are set:

curl --noproxy '*' https://example.com

10. Ensure SSL/TLS settings are correct. To debug, we can disable SSL verification:

curl -k https://example.com

[Need more help to solve this error?- We’re available 24/7 to help you.]

Conclusion

In short, cURL error 7 failed to connect to port 443 mainly occurs when the firewall blocks the curl request. Today, we have discussed this error in detail and saw how our Support Engineers fix it for our customers.