XMLRPC Error with Wordpress (SOLUTION)

XMLRPC Error with Wordpress (SOLUTION)

Posted by: blueorder
Posted on: 2007-05-11 22:57:00

I'm posting this just in case someone else has an problem with this. Let someone else benefit from my digging around.

If you are having problems posting through XMLRPC, the problem resides with PHP. There is a known bug in PHP 5.2.2 where HTTP_RAW_POST_DATA fails to ever be set.

The solution, for now, is to 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");


The beginning of my xmlrpc.php file looks like this:

<?php

define('XMLRPC_REQUEST', true);

// Some browser-embedded clients send cookies. We don't want them.
$_COOKIE = array();

if (phpversion()=="5.2.2") $GLOBALS['HTTP_RAW_POST_DATA'] =
file_get_contents("php://input");


And XMLRPC is now working again.

blueorder

Re: XMLRPC Error with Wordpress (SOLUTION)

Posted by: cygnoir
Posted on: 2007-05-15 00:50:00

Thank you so much for this. I was so frustrated before I found this. I modified my xmlrpc.php file, and now everything works again.

Tags: php filewordpressphp 5benefit