I've been getting into trouble with the entire localhost installation of WordPress that reports CURL error 28 (timeout) from (I believe!) I changed my PHP version from 7.0 to 7.2 with brew on my local Mac OS machine. When viewing any of the administration areas of my local site or using the WP CLI, the WP update checks and other calls to cURL result in unsuccessful cURL requests:
Warning: An unexpected error occurred. Something may be wrong with
WordPress.org or the configuration of this server. If you keep having
problems, please try the support forums. (WordPress could not
Establish a secure connection to WordPress.org. Please, contact your
server administrator) in /Users/…/wp-includes/update.php on line xxx
(the line xxx varies depending on the installation, the local https site or not, etc., but always reduces to a line that detects a curvature error)
As far as I can tell, PHP is using the installed brew. CURL and cURL works both in CLI and in PHP, for example. executing this explicitly in a functions.php theme works and returns the expected result (a JSON of updates):
$ ch = curl_init ("http://api.wordpress.org/core/version-check/1.7/"); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, TRUE); var_dump ("exec", curl_exec ($ ch)); var_dump ("error", curl_error ($ ch)); curl_close ($ ch);
Similarly, just getting a CURL request in the terminal also works:
curl -v http://api.wordpress.org/core/version-check/1.7/
Both return the same JSON.
I tried to edit my WP
/ wp-includes / Several classes related to http, request and cURL to debug what is happening. Since the cURL function of functios.php works, but the internal function of WP does not, I assume that my PHP PHP works on itself.
/wp-includes/Requests/Transports/cURL.php I have tried to comment on so many
curl_setopt Calls as possible to approach the same minimum cURL call that works in my functions.php but no luck. I also do not know a way to see the exact cURL configuration with which the request is sent.
curl_getinfo reveals mostly empty or predetermined values, such as what you would expect with a request that was never successful.
Other things that I have tried and tested:
- The Health Check plugin was installed to confirm: Yes, the REST API fails, the WordPress.org connection fails, the Loopback request fails
- Various combinations of: add-ons and disabled themes, without add-ons, new installation of WP
- phpinfo () tells me that cURL is enabled (v7.64.0)
- Reinstalled curl, openssh, email@example.com through brew several times
- Restarted computer, restarted apache server
- Posted in wp.org
- The php error log was verified, WP debug.log verified, error_reporting was set to (E_ALL): nothing suspicious about cURL calls is seen
- The firewall is disabled (the other cURL calls also work, so …)
I am absolutely disconcerted about what is happening here and why the WP CURS requests are failing and essentially rendering my entire development environment useless.
Any help or suggestion to get to the bottom of this is very, very appreciated.