Wordpress - The Jetpack server could not communica

2019-08-17 19:07发布

问题:

When I try to install Jetpack on my Wordpress website I get the following error:

Error Details: The Jetpack server could not communicate with your site’s XML-RPC URL. Please check to make sure example.com/xmlrpc.php is working properly. It should show ‘XML‑RPC server accepts POST requests only.’ on a line by itself when viewed in a browser and should not have any blank lines or extra output anywhere.

When I goto the URL I see this:

XML‑RPC server accepts POST requests only.

Which is expected. It feels like I have tried everything I have googled and everything here:

https://jetpack.com/support/getting-started-with-jetpack/what-do-these-error-messages-mean/blank-lines-xmlrpc/

I have tried uninstalling all plugins and still does not work :(

What am I doing wrong?

Please help!

回答1:

Looking at the link, they specifically mention whitespace or output that could be causing issues, and ask you to check there isn't any before the opening PHP tags etc.

The reason they talk about this is because if there has been any output at all, then PHP will no longer be able to send any HTTP headers!

If your files look ok, then I guess (guarantee even?) that your display_errors is turned on. Depending on the level of error_reporting in your ini file, any little notice or warning will create output, and therefore stop any further HTTP headers from being set.

For the best error logging experience (and hopefully to also fix your error), set error_reporting to -1, turn display_errors off, and set a custom error_log. Then in the terminal, type tail -f /path/to/error_log. Your notices, warnings and errors will now scroll past in real time, without distorting your web page's display.