PHP 5.2.2 breaks XML-RPC in WordPress

May 31, 2007 · Comments

in Software, Technology, Weblogs

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…

Other relevant posts you may find interesting:

Previous post: Bruce Willis in conversation

Next post: The Hobson & Holtz Report - Podcast #245: May 31, 2007