Archives

  • 2014 (132)
  • 2013 (85)
  • 2012 (95)
  • 2011 (147)
  • 2010 (194)
  • 2009 (184)
  • 2008 (265)
  • 2007 (113)
  • 2006 (173)
  • 2005 (74)

Optimise WordPress

Following my move to Linode, I’ve been reviewing my WP installation with the aim of streamlining the size of the database, increasing the speed of the site and reducing the amount of time needed to back both the directory and database. Here’s what I did.

First the easy thing, I deleted all of those unnecessary plugins. I removed five unused and obsolete plugins which were simply taking up space.

One plugin I binned was a rather an ineffectual caching plugin. I tried a couple of replacements but found that W3 Total Cache which came highly recommended, seemed best for my set up. Subjectively at least, viewing pages feels faster.

Next I turned my attention to the database. My wp.sql file was 60MB before I started tweaking. Looking at the tables in phpmyadmin, I saw that wp_statpress and wp_posts were the largest components. I found and ran the commands to optimise those two tables. Obviously before doing any work on an important database, make a back up – or two!

Login to your database: # mysql -u root -p databasename

Then run the commands:
OPTIMIZE TABLE wp_posts;
OPTIMIZE TABLE wp_statpress;

You’ll see an output similar to this each time you run the command.

mysql> OPTIMIZE TABLE wp_posts;
+————-+———-+———-+———-+
| Table       | Op       | Msg_type | Msg_text |
+————-+———-+———-+———-+
| wp.wp_posts | optimize | status   | OK       |
+————-+———-+———-+———-+
1 row in set (0.16 sec)

If you you see “Table is already up to date” instead of OK the table is as optimised as it can be.

The above process may optimise the database from the MySQL server’s point of view but it didn’t’t reduce the overall size . To achieve that, removing the copies WordPress makes of each post revision had the largest effect. Again from the  MySQL command line run:

DELETE FROM wp_posts WHERE post_type = “revision”;

I executed the above and then repeated the optimise table command.

As a result, the total wp.sql file shrank from 60MB to 45MB which is impressive. There are some WP plugins available which can also assist with “weight loss” but as the above commands are so quick and effective, I didn’t see a need to try them.

Finally, you can amend your wp_config file to prevent WordPress retaining say more than 3 revisions per post. Personally, I’d rather have the option of as many revisions as needed and occasionally perform the above steps when the DB becomes bloated.

Evidence – pah!

emotional-point

or

1981984_10202882106349739_1646133045_n

or

thomas-paine-arguing-600x305

Mr. Bluenote

I may have a Telecaster, I may have the same pickups, I may have as good an amp but I don’t (yet) have the ability of Mr. Bluenote.

The meaning of life

Douglas Adams would most definitely approve of this alteration.

42

WordPress – blank admin page

This morning I updated a couple of plugins on my WP install – JetPack and Google-Analytics – but was then presented with the famous blank, admin page of doom. This is a seemingly a common problem with WordPress, if the number of support requests on the WP forums is anything to go by. The advice and suggestions for fixing this are legion, I tried the following without success:

  • Re-install WordPress from scratch
  • Check and remove any spaces from wp-config.php
  • Check your wp-config.php is not corrupt
  • Check and remove any spaces from wp-login.php
  • Check your theme’s function.php for corruption
  • Use a PHP debugger to check the php status of your site
  • Restart your Apache and MySQL servers
  • Refresh your browser’s cache

Well none of those worked. But I eventually find a solution.

Renaming the plugins folder in wp-content to something other than plugins solved the problem. When it was renamed, the admin page console displayed once more and jumped to the plugins page, complaining that all the plugins were missing / inactive. I then reverted the plugins folder to the correct name and all was well once more.

It goes to show that the WP software can be temperamental and somewhat flaky. Having backups increases the options when something goes amiss, even if simply renaming a folder resolves the problem. It may not be that easy next time.

EDIT: after another period of testing, the fault was caused by The Google Analytics by Yoast version 5.2.4 which expects your sever to have php5-curl installed. Despite installing that php5 module I could not get the plug-in to work. So I’ve downgraded to the previous version until a fix is forthcoming.

EDIT 2: After some fast work by Joost de Valk and the folk at Yoast – the fix has been written! Nice and speedy work chaps!

 

Creation

attenborough

Water of Leith Birds

On the way to work, I was pleased to see, for the first time this year and for the first time in a couple of years, a male Goldeneye on the Water of Leith. The males are beautifully decorated and the one I saw was chasing a female mallard in an aggresive manner. They are aptly named and have those easily identifiable stripes and cheek patch to distinguish them from the similarly sized Tufted Duck. I’ll have to bring the bins in to work to have a closer look.

common_goldeneye-2667

While not up to the professional quality of the shot above, the colouring of the male Goldeneye reminds me of the male Goosander. Again these are spotable on the Water of Leith, as you can see from this shot from my smartphone. I’m not sure what collective noun applies to Goosanders but it’s probably quite rare to see this many in one spot. There were a couple out of shot also. The males have a dark green head like the Goldeneye and the females a brown head.

gooseanders

 

Not alone

Christmas feck!

bah