Cannot connect Discourse to WordPress

AI-generated summary

Cannot connect Discourse to WordPress

CMASFO is experiencing issues connecting their WordPress site to Discourse using the WP Discourse plugin. They receive an error message stating that an invalid response was returned from Discourse and provide connection logs. The logs show a 404 error and a failed SSL verification. angus suggests checking a related post and another post about a similar error.

After trying multiple environments, CMASFO resolves the issue by manually installing WordPress. angus suspects that the problem was likely due to the version of php-curl on the server.

I made api key, typed url, api, username, and this is what I get from the WP Discourse plugin.

You are not connected to Discourse. Check that your connection settings are correct. If the issue persists, enable connection logs and check Logs.

And this is the log that I get.

[2022-06-05 17:20:38] connection.INFO: check_connection_status.failed_to_connect {“error”:“wpdc_response_error”,“message”:“An invalid response was returned from Discourse”,“http_code”:“”,“http_body”:“”}

And sometimes this log.

[2022-06-05 16:14:55] connection.INFO: check_connection_status.failed_to_connect {“error”:“wpdc_response_error”,“message”:“An invalid response was returned from Discourse”,“http_code”:404,“http_body”:“\r\n404 Not Found\r\n\r\n<h1>404 Not Found\r\n<hr><center>nginx\r\n\r\n\r\n”}

I also check curl and this is what I get.

curl: (60) SSL: no alternative certificate subject name matches target host name ‘cmasfo.com’
More details here: curl - SSL CA Certificates

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.

What should I do in this situation?

Hey @CMASFO, welcome to meta :slight_smile:

For this kind of issue please see my response here

In particular:

I’d recommend you press your hosting provider a bit more, asking them why there’d be an inability to make a cURL request to a domain. If they have some more specific reason to think it’s an issue with the WP Discourse plugin, and not say, an incorrect cURL version on the server (which on the face of it is more likely), they’re welcome to post here, or even pm me, and I’d be happy to look into it further with them.

And

Let me know how you go with those.

I experienced this problem from 2 environments.

one was bitnami wordpress stack, and the another was aapanel.

so I just tried to install wordpress manually,
like installing server and database by hand,
and now it works!

just wonders what the problem was

thx for replying

It was most likely the version of php-curl on your server.