WordPress error when connecting from a desktop writer application

My adventures with the wordpress aren’t over yet !

Today I downloaded Windows live writer and tried to use it to write posts on my blog as the default editor of wordpress seemed too simple for me. As the site was working fine via the browser, I thought that all is really well.

But as Live writer tried to connect to the blog, it gave me the following error

Invalid server response รขโ‚ฌโ€œ The response to the blogger.getUserBlogs method received from the blog server was invalid : blah blah blah

This is the error if you fancy reading it

image

 

So I tried to open the http://198.1.75.221/~amilagmc/xmlrpc.php from the browser. Bang it failed too !!!

As the error had some useful information with it I opened the xmlrpc.php from my local folder and checked the line with the error. It was the 30th line :

include('./wp-load.php');

Just like in my previous post I changed that line to

include('wp-load.php');

and uploaded the file. Then tried the http://198.1.75.221/~amilagmc/xmlrpc.php again. Then it gave me this

XML-RPC server accepts POST requests only.

Ok looks like it is working now ๐Ÿ˜€ . Back to Windows Live Writer.

It falied again with the same error ๐Ÿ™

Then I checked the XML response returned from the wordpress via the charles proxy and it showed that a part of the closing </methodResponse> tag was missing actually it was like </methodRespo. So the returning xml was invalid and that caused the error. 

After about 2 hours of digging through the wordpress source I finally found the culprit ๐Ÿ™‚

So here’s the strangest part

In the \wp-includes folder there is a file named class-IXR.php. In the line 332 of that, there’s a statement

$xml = <<<EOD
<methodResponse>
  <params>
    <param>
      <value>
        $resultxml
      </value>
    </param>
  </params>
</methodResponse>

EOD;

Note that there is only one blank line between the </methodResponse> and EOD. When I increased the number of blank lines, the missing parts of the  </methodResponse> began appearing gradually.

Finally I added 5 blank lines before the EOD; and bang it is working. Now the final code looks like this

$xml = <<<EOD
<methodResponse>
  <params>
    <param>
      <value>
        $resultxml
      </value>
    </param>
  </params>
</methodResponse>





EOD;

I have no earthly idea how this is happening. But however it is working fine. I am hosting this site on a Windows Server 2008 box with IIS 7.0 and PHP 5.X may be it is an issue with running php on windows.

Anyway all is well at least for now ๐Ÿ˜€

Happy blogging

Manually installing WordPress on a shared host

In this post I’ll explain how to manually install wordpress on a shared host.

If you already have a hosting account there is no need to pay for a separate wordpress hosting account as the manual installation is really simple even for a person like me who does’t have any experience with php ๐Ÿ™‚ .

By hosting wordpress on your own, you get many features like custom themes, advertising support and it won’t cost you a fortune either. You can find a host for just about $7.00 per month.

Note

If you are using a windows hosting account please make sure that your hosting account supports PHP (ver. 5 or higher) and MySQL

This is the method I used to setup this blog on my windows hosting account with Arvixe.

So here are the steps;

Step 1. Download wordpress

Download the latest version of wordpress from http://wordpress.org/latest.zip and extract it to a local folder

Step 2.  Create a MySQL database and a user for the database

Using the cpanel of your hosting account or a mysql client  create a MySQL database and a user for the database. Keep the db name and the user name handy as it will be required in a later step.

Step 3. Edit the database parameters

Go to the location where you extracted the wordpress in step 1 and rename wp-config-sample.php to wp-config.php. Then open it in a text editor like notepad. Follow these steps (from the wordpress.org)

Locate the line

// ** MySQL settings – You can get this info from your web host ** //

Underneath that line there are lines like

define('DB_NAME', 'database_name_here');

These are the configuration settings and you need to change them according to database and the user you just created. So change the values of following settings as below

DB_NAME 
The name of the database you created for WordPress in Step 2 .

DB_USER 
The username you created for WordPress in Step 2.

DB_PASSWORD 
The password you chose for the WordPress username in Step 2.

DB_HOST 
The hostname you determined in Step 2 (usually localhost, but not always; see some possible DB_HOST values).

DB_CHARSET 
The database character set, normally should not be changed (see Editing wp-config.php).

DB_COLLATE 
The database collation should normally be left blank (see Editing wp-config.php).

Step 4. Editing authentication keys

Find the section named

            Authentication unique keys and salts

These are some fancy values to make your wordpress installation more secure

Click this link and replace the lines in the above section with the lines given by the link

https://api.wordpress.org/secret-key/1.1/salt/

Step 5. Modify index.php – For windows hosts only

If you are hosting wordpress on a windows host there’s a little trick that you need to do. So open index.php on a text editor.

Locate the following line and modify it as below

require('./wp-blog-header.php');

change it to

require('wp-blog-header.php');

If you missed this step, you’ll get the following error.

Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in D:\bikedenver\www\index.php on line 17

Fatal error: require() [function.require]: Failed opening required รขโ‚ฌหœ./wp-blog-header.php’ (include_path=’.;C:\php5\pear’) in D:\bikedenver\www\index.php on line 17

Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in D:\bikedenver\www\index.php on line 17

Fatal error: require() [function.require]: Failed opening required รขโ‚ฌหœ./wp-blog-header.php’ (include_path=’.;C:\php5\pear’) in D:\bikedenver\www\index.php on line 17

So if you got the above error you know what to do now ๐Ÿ™‚

Step 6. Upload the files

Save all the edited files and upload all the files in the local wordpress folder to your hosting account. Make sure not to upload the wordpress folder itself. Upload only the files inside it to the root of your hosting account

Step 7. Browse the site

Fire up your browser and browse to the wp-admin/install.php.

Ex.  http://example.com/wp-admin/install.php

Fill the details and complete the installation. That’s it. Voila you’ve installed worpress.

Now browse to your home page and see if everything is ok.

Step 8. Test the xml rpc api

You need to follow this only if you are planning to use another application (like Windows live writer or blog desk) to do posting only.

Start your application and test if you can publish new posts without any issues. But if it fails and you are running wordpress on windwos, Follow this article to see if it can solve the issue

Happy blogging