When writing drafts for my blog posts, I prefer to use offline blog authoring editors. First, I used Windows Live Writer, part of Windows Essential, but after it reached the end of support in 2017, I switched to forked open-sourced version "Open Live Writer". I also installed EasyPHP on my local machine, to publish the drafts to my local WordPress site for further processing. The problem was that the "Open Live Writer" was not letting me add a blog account. It was giving me an error message about Invalid Server Response. In this article, I will show you what I tried and what fixed the issue.
The error message I received was:
Invalid Server Response - The response to the blogger.getUsersBlogs method received from the blog server was invalid:
Invalid response document returned from XmlRpc server
Please try fixing the problem and then try again.
When adding a blog account, I also tried to choose “Other services” option, instead of “WordPress”, but received the same error message.
Next I changed the “Web address of your blog:” field to only point to localhost at 127.0.0.1
:
This opened a different window “Select blog type”:
After choosing “WordPress 2.2+” from the "Select Blog Provider" dropdown menu, the “Remote posting web address for your blog:” field was filled with the following link:
http://<hostname>/<wp_path>/xmlrpc.php
I edited this link to point to the xmlrpc.php
file of my local WordPress site, but again I received the same error:
It seemed the issue was not with the setup in Open Live Writer / OLW, but was somewhere else. Here are the different ways I tried to solve the problem:
Checking XML-RPC function in WordPress
Since the Open Live Writer error message mentioned XmlRpc and the application were giving me the option to add a path to xmlrpc.php
file, I first focused on XML-RPC.
XML Remote Procedure Call or XML-RPC allows you to interact remotely with your WordPress website. There are posts on the web suggesting to turn on XML-RPC in WordPress, but it turns out, this feature is turned on by default since WordPress 3.5.
To determine, if XML-RPC is enabled on WordPress, go to www.yoursite.com/xmlrpc.php
which should give you the following message:
XML-RPC server accepts POST requests only.
If the XML-RPC is enabled, then running xmlrpc.php
in browser will cause 405 status error (Method not allowed) and display the above message as this was GET and not POST requests.
In my case, the XML-RPC was working fine, so I kept looking.
Increasing memory limit and File Upload Limit in php.ini
Then I stumbled on some suggestions that the memory_limit or upload_max_filesize in PHP might be too low. Inside the php.ini
file, I had the following settings:
upload_max_filesize = 2M
memory_limit = 128M
They looked fine to me, but I increased the upload_max_filesize to 25M just in case. After stopping / restarting Apache server, this change didn’t do anything.
Checking Open Live Writer log file
Then I discovered that the OpenLiveWriter had a log file.
On Win10, the file is located at:
%LOCALAPPDATA%\OpenLiveWriter
if you are still using Windows Live Writer, the log file should be located at:
%LOCALAPPDATA%\Windows Live Writer
When I checked the log, I noticed the following error message:
<b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br /> <?xml version=""1.0"" encoding=""UTF-8""?>
This seemed to indicate that while WordPress XRP-RPC was expecting XML format, it instead received the PHP deprecated warning. This warning breaks the XML and causes it to complain that the XML response was invalid. So the obvious solution was to get rid of this deprecated warning.
Removing the PHP deprecated warning
The error in Open Live Writer log file mentioned $HTTP_RAW_POST_DATA being deprecated and to set always_populate_raw_post_data to -1. In php.ini
, this line was commented out:
;always_populate_raw_post_data = –1
After removing the comment and restarting the server, the Open Live Writer was able to add a blog account and publish my draft to the local WordPress site without any issue.
Another way to get rid of the warning
The solution in the previous section was simple, but what if you have a notice, strict or deprecated warning and you are unsure how to fix it. The quickest way would be to make sure the PHP doesn't complain about them. We achieve this by setting error_reporting in php.ini
to the values below:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
Conclusion
If you are using Open Live Writer or any other blog authoring editors and get an error about Invalid Server Response using XML-RPC, it might be due to php.ini
configuration. Checking the Open Live Writer log file can give us a clue, on what exactly is causing the issue. In my case, it was due to PHP "deprecated" warning. Fixing this warning solved the issue.
yaron
November 30, 2017Thank you very much. Solved my problem.
Bruce
February 5, 2018Thanks for the excellent instructions. I get this a lot while creating or changing WordPress blogs/sites. Although a novice WPer, I can do basic stuff, but editing php.ini on the server is beyond my scope.
A plugin to whitelist my IP for enabling xml-rpc seemed to work, but when it doesn't I'm at a loss.
SO... just for those who run out of options, this can also work:
Make a copy of xmlrpc.php in the WP directory and rename the COPY to xmlrpc2.php and enter that name into the WLW or Open Live Writer dialog when creating a new account.