PHP 5.2.2 breaks XML-RPC in WordPress

If you use an offline blog editor like ecto or BlogJet, and the server hosting your WordPress blog uses PHP version 5.2.2, you might encounter the problem I have for the past 24 hours.

What happened was that every time I wanted to publish a post to this WordPress blog from BlogJet, I’d get an error message with this text:

Invalid payload received from xmlrpc server.
Server said:
“XML-RPC accepts POST requests only.”

Nothing has changed with any file in my WordPress installation nor with anything in the blog configuration at my end. All I could think of was that something had changed on the server during the past 24 hours. So I filed a support ticket with DreamHost.

Then I noticed that the PHP version on my server is reporting itself as 5.2.2. The last time I looked, a week or so ago, I’m certain it said 5.2.1. So it appears that DreamHost upgraded PHP.

Anyway, a quick Google search on the phrase “XML-RPC accepts POST requests only” turned up this solution by FolioVision:

[…] edit the xmlrpc.php file in your WordPress installation and add the following code:
if (phpversion()=="5.2.2") $GLOBALS['HTTP_RAW_POST_DATA'] =
file_get_contents("php://input");

I edited my xmlrpc.php file as suggested – and it works.

Very frustrating if you encounter this problem. Thanks to bloggers like our friend at FolioVision, it’s fixable for WordPress blogs.

This could also explain why I received an XML-RPC error when I installed the new version of Windows Live Writer this morning and tried to configure the blog settings. Need to try that one again…

Neville Hobson

Social Strategist, Communicator, Writer, and Podcaster with a curiosity for tech and how people use it. Believer in an Internet for everyone. Early adopter (and leaver) and experimenter with social media. Occasional test pilot of shiny new objects. Avid tea drinker.

  1. neville

    Hope dinner was good ;)

    That edit does work. In fact, the issue is documented on WordPress support and is a known bug.

    The workaround mentioned in the WordPress ticket (same as the one I mention in this post) says it’s for WP 2.2. The fix clearly works on earlier versions – I’m running 2.0.10 on this blog.

  2. Simon Wakeman

    Testing the new Windows Live Writer…

    This is my first post using the new beta version of Windows Live Writer – an impressive free offline blog editor.
    ……

  3. Simon Wakeman

    Hi Neville,
    I’ve successfully used the new WLW beta on WordPress2.2 running on PHP5.2.2, hosted by dreamhost.

    The WLW set up went fine and I’ve successfully posted to my blog. I haven’t applied the fix, so either the WLW issue you had isn’t connected to this XML-RPC issue, or the latest version of WP2.2 doesn’t have the problem?

    I’ll stop trying to be tech support now – I should stick to what I know really :)

    Looking forward to seeing/hearing you at DTNP2.0 on Tuesday

    cheers,
    sw

  4. neville

    I think you’re right, Simon – if you’re running WP version 2.1 or later, it looks as though you won’t have a problem with this.

    After I published this post, I recalled something about PHP and WordPress a few months ago. Indeed, I wrote about it at the time!

    I’ve been working with DreamHost support as a guinea pig on this issue especially re why WLW won’t configure itself for this blog. They’ve changed something else on the server, but with the result that I now can’t post anything to the blog at the moment with any offline editor. Hopefully they’ll fix that this weekend.

    So it’s now pressing that I upgrade this blog to the latest WP version. That’s in hand along with a refreshed design using a different theme. Up soon, I hope.

    Yes, see you Tues!

Comments are closed.
Close