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 installed PHP, Apache, MySQL 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 the browser will cause a 405 status error (Method not allowed) and display the above message as this was GET and not POST requests.
XML-RPC functionality blocked by your hosting provider
This solution was suggested by Bruce commentator and it seems to be a common issue.
Years ago, there was a vulnerability in the xmlrpc.php
WordPress core file, so some hosting providers blocked the functionality of this file. Nowadays though, the REST API is replacing the functionality of xmlrpc.php
so various hosting providers are again started blocking it.
Luckily, the solution for it is pretty simple. Make a copy of xmlrpc.php
file and name it something else like xmlrpc2.php
. Now all that is left is to use URL that points to this duplicated file:
www.yoursite.com/xmlrpc2.php
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:
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.
Louis Kessler
April 14, 2021I found your blog post when I got a 409 server error returned from Open Live Writer trying to upload my post to my WordPress blog on my website. I've been using Open Live Writer (and Windows Live Writer before that) for years to write my blogs. Two weeks ago it worked fine. Today it didn't. As far as I know, I changed nothing and nothing changed at my host. Obviously something changed, but I don't know what.
But I wanted to thank you for writing this post. Your solutions didn't work for me, but Bruce's solution copying xmlrpc.php to xmlrpc2.php happened to and I'm so relieved. And he wouldn't have responded if you didn't write this post. And of course, thank you Bruce as well.
Andreas
March 1, 2022This fix doesn't work for me either. I had a similar problem some years ago and the problem was cPanel's ModSecurity, but eventually it was fixed. Now my provider replaced the server with new cPanel ver 100.0.11 and the problem is back again. But this time there is no ModSecurity as an option. I'm waiting response from tech support.
David
October 5, 2022Thank you for this article. I renamed xmlrpc.php and now I can use Open Live Writer to create posts again. My service provider must have started blocking this file recently and I had no idea they would ever even do that.
mysticrunes
April 10, 2023This solved my issue! Thank you!